3
From Deploying static files in the Django documentation, you must run the collectstatic
command in addition to setting the STATIC_ROOT
setting.
First make sure that you’re STATIC_ROOT is set to the correct path that matches your nginx config:
STATIC_ROOT = '/home/django/innovindex/pubmed/static/'
Note that this is an absolute path.
Then run:
python manage.py collectstatic
in your project directory.
This will copy all of your static files into /home/django/innovindex/pubmed/static/
3
I spent a lot of time trying to figure this out until I found that the below must be in your main urls.py
. Just add those two lines.
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
# ...
urlpatterns += staticfiles_urlpatterns()
- [Django]-Create() argument after ** must be a mapping, not unicode
- [Django]-Do websockets send and receive full messages?
- [Django]-Python: Convert Quill delta to HTML
- [Django]-In Django templates, `Context` is a stack. What for?
Source:stackexchange.com