I have been trying to test my Django project before deploying it on a cpanel
settings.py
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'), ]
I have been trying to test my Django project before deploying it on a cpanel
settings.py
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'), ]
2
Answers
====== in project urls.py ========
urlpatterns
modification to serve static files is recommended in development.If you want to serve your static files from the same server that’s already serving your site, the process may look something like:
STATIC_ROOT
.STATIC_ROOT
underthe URL
STATIC_URL
. For example, here’s how to do this with Apacheand
mod_wsgi
.How to use Django with Apache and mod_wsgi