[PYTHON] [Day 2] Project generation

January 7, 2021 ← Last time: Day1 Django development environment

Precautionary statement

This article is not a single article. I wrote it as a diary, so I think it will be useful for those who are new to it. If you want to learn Django, we recommend reading it from [Day 1] Django Development Environment.

Project generation

This time we will create a project with the name "mysite".


$ source venv/bin/activate #The one to make venv
(venv)$ django-admin startproject myproject

The contents of the generated project.

.
|--manage.py
|--mysite
    |--__inin__.py
    |--settings.py
    |--urls.py
    |--wsgl.py

Language setting

It's English as it is now, so let's change it to Japanese. Edit the settings.py file in the mysite directory.

$ emacs settings.py

From

- LANG='en_us' #Where it is
+ LANG='ja'    #'ja'Let's

Time zone setting

From settings.py as well as language settings

- TIME_ZONE = 'UTC'
+ TIME_ZONE = 'Asia/Tokyo'

Edit to.

Check your browser

The mysite directory is now created. Let's check the created project with a web browser.

(venv)$ cd mysite
(venv)$ python manage.py runserver 8080

Please visit localhost: 8080 and check. If you see a picture of a rocket, you are successful.

See you again

← Last time: Day1 Django development environment → Next time: Preparing to connect to the Day3 database

Recommended Posts

[Day 2] Project generation
Project Euler 37
Project Euler 7
Project Euler 47
Project Euler 31
Project Euler 4
Project Euler 38
Project Euler 17
Permutation generation
Project Euler 26
Project Euler 23
Project Euler 22
Project Euler 19
Project Euler 50
Project Euler 42
Project Euler 33
Project Euler 32
Project Euler 43
Project Euler 36
Project Euler 24
Project Euler 46
Project Euler 48
Project Euler 45
Project Euler 6
Project Euler 39
Project Euler 49
Project Euler 29
Project Euler 27
Project Euler 41
Python day 1
Project Euler 30
Project Euler 16
Project Euler 14
Project Euler 34
Project Euler 25