As our project is ready, we can continue to configure the settings.py
file, in order to render the templates, static and media files correctly.
The following changes needs to be done inside the settings.py
file.
For template configuration you can refer https://edkool.com/courses/django/template-configuration
The following code needs to be updated inside the settings.py
file in order to render templates and a template folder needs to be created inside the project's working directory.
import os
'DIRS': [os.path.join(BASE_DIR, 'templates')],
For static configuration the following changes needs to be done and a static folder needs to be created inside the project's working directory. For further details you can refer https://edkool.com/courses/django/static-folder-configuration
STATIC_URL = '/static/'
STATICFILES_DIRS=[os.path.join(BASE_DIR, "static"),]
For media configuration the following changes needs to be done and a media folder needs to be created inside the project's working directory. For further details you can refer https://edkool.com/courses/django/media-configuration
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')