[PYTHON] Django startup

Reference URL: https://qiita.com/YoshitakaOkada/items/f434bb0bc493ff9cd65b

Last time I was able to successfully start the local server in Python and simply display the fixed value graph (see: https://qiita.com/Takuto_Yoshimura/items/fbcdf337524adbf72e79)

Next, it seems that the html rewritten with DOM (script?) Will be displayed. (First of all, is this understanding okay? Lol) Well, it doesn't make sense to worry about that, so I'll try it for the time being.

(It's a personal story, but I'll try it for the time being! I like the mindset of taking advantage of this reflection and utilizing it in the next action (strategy), and I hate the "PDCA cycle" that is often said in the streets. Lol Before making a plan, you should just shoot a jab and see what happens. If you force it, it's a (D) PDCA cycle. I learned later that it's exactly the concept of an OODA cycle.)

Then, as usual, I stumble from the beginning.

Django seems to manage monogoto in units of "projects" and multiple "applications" in it like visualstudio. The project name is "mysite" for the time being.

django-admin startproject mysite

But the "mysite" folder doesn't appear in "basic_django_graph"! I was worried about why ~ why ~, and when I looked closely, it was created in the folder "basic_js_graph" I made last time! Lol

スクリーンショット 2020-09-06 11.23.01.png

take heart Recreate it in basic_django_graph and continue. It was an ordinary mistake. スクリーンショット 2020-09-06 11.31.26.png

Next, type cd my site in the terminal. → Nothing in particular (If you get any error, it's annoying, but if you don't say yes or no, that's anxiety lol) → Well, next with some spirit → Next, type python manage.py runserver

→ An error came! !! (A reactionary reaction that I didn't say yes or no, I'm a little happy if an error occurs)

yoshimunnoiMac3:mysite TakutoYoshimura$ python manage.py runserver File "manage.py", line 17 ) from exc ^ SyntaxError: invalid syntax

Well, I was hoping that it would be honest from the last few experiences.

→ python3 manage.py runserver

Type in.

→ Somehow it is said to be in the red, but the text is the same as the model, and the server seems to be running. スクリーンショット 2020-09-06 11.55.02.png

→ In your browser http://127.0.0.1:8000/ Try to type スクリーンショット 2020-09-06 11.48.48.png

Alright!

→ Next> Create an application folder. Name it test_chartjs → k. So far so far

But then

>python3 manage.py startapp test_chartjs

When you hit

スクリーンショット 2020-09-06 12.09.46.png

→ What a smile test_chartjs has a name that matches other Python modules, so rename it.

Hmm. I don't know, but python3 manage.py startapp test_chartjs If that doesn't work python3 manage.py startapp test_chart

I'll try it with a shit suitable glue.

→ A folder called test_cahrtt has been created! In other words, it was because I originally created a folder called "test_chartjs" first. スクリーンショット 2020-09-06 13.59.42.png

→ If you find out, delete the test_chartjs folder once! Lol

python3 manage.py startapp test_chartjs When you type,

スクリーンショット 2020-09-06 14.02.00.png

→ Alright, success!

Create a new urls.py to change the URL association from the rocket animation Hello World (create it in the test_chartjs folder). For convenience, it may be called "children's urls.py".

Ah, a programmer's colleague used to say "child" or "parent" at the previous workplace. (Also, I said something like "Kill the child," but I now understand that the point is to invalidate some code in the lower hierarchy?)

→ If you go crazy several times, he will point out that this is wrong in the red (it is convenient.) → Crush one by one python3 manage.py runserver

When you enter,

スクリーンショット 2020-09-06 15.31.56.png

Is this a move? .. ..

→ Well, even if I'm worried (ry → Access http: // localhost: 8000 / test_chartjs /

→ "hello world" is here! Shah!

スクリーンショット 2020-09-06 15.34.19.png

Try accessing http: // localhost: 8000

スクリーンショット 2020-09-06 15.35.58.png

Yeah, as a model!

→ If you think it's going well, you'll stumble at MySQL.

Or rather, on Mac you need Xcode to install MySQL It's 11GB w. The fixed line of my house is only about 1Mbps depending on the time zone, so it's not technical. The line is poor and it takes a long time to download, so I can not proceed. .. Lol (especially late over the weekend ...)

スクリーンショット 2020-09-06 17.03.24.png (I've been watching the display for the remaining 1 hour for at least 10 hours, but that is ...)

The article has become long, so I'll close it here. I will write the continuation in another article.

Recommended Posts

Django startup
Django
django update
Django note 4
WEB application development using Django [Django startup]
Django memorandum
django search
Django installation
Django Summary
Django test
Django # 2 (template)
Django Note 5
Django hands-on
Touch django
Django Summary
Django Shoho
Django + Docker
Django Glossary
Django search
Install Django
Django: References
Django Note 1
Django note 3
Django note 2
Django notes
Django NullCharField
Django environment construction
Django ~ settings.py edition ~
Django Heroku Deploy 1
Startup Intel Edison
Django HTML Template # 2
Django Contact Form 2
Django begins part 1
Django model: ManyToManyField
What is Django? .. ..
Models in Django
Django function-based view
Python Django Tutorial (5)
Django Learning Memo
Python Django Tutorial (2)
[Django] as_view () notes
First Django Challenge
django makemigarations createsuperuser
Django related sites
Django version check
Django begins part 4
Django 1.9 for internationalization
CentOS8 --Play --Django
CentOS8 --Install --Django
django tutorial memo
[Django] Redo migrate
django environment construction
Python Django Tutorial (8)
Python Django Tutorial (6)
django default settings
Start Django Tutorial 1
Django HTML template
Django Template Tips
Django girls-3 workflow
Django Project Baseline
Django Heroku Deploy 2