This article was written to make a note of the settings.py settings in Django.
First, let's set the time zone. If you open "settings.py" and scroll to the gar
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
I will find this part, so I will change it a little.
LANGUAGE_CODE = 'ja'
TIME_ZONE = 'Asia/Tokyo'
By changing in this way, you can adjust to Japan time.
Scroll a little from the top of "settings.py" and find "INSTALLED_APPS" elsewhere. We will add it here to register the application configuration information. Here, the app name is "app".
INSTALLED_APPS = [
'app.apps.AppConfig',
]
Add it like this at the very beginning or end of the parentheses. Be careful not to forget the last comma.
If you go a little further down from "INSTALLED_APPS" you will find something called "TEMPLATES". Register "templates" to store the HTML file here.
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
It should look like this. I will register in "DIRS" here.
'DIRS': [os.path.join(BASE_DIR, 'templates')],
If you can put it in this way, you're done.
We will register the "static" directory where CSS, JavaScript, images, etc. are stored. By default, it is not held, so I will add it at the end.
STATICFILES_DIRS = (
[os.path.join(BASE_DIR, 'static')]
)
It's perfect if you add it like this.
This time, I have summarized what to write in "settings.py". I plan to have more dates in the future. Previous article Procedure to create application with Django with Pycharm ~ Preparation ~
Recommended Posts