I\'ve been messing around with the new collectstatic
command and have got it working for my normal pages. That is to say, I am able to load my css at this locat
Django recommends that you deploy static files with a web server other than wsgi.
STATIC_ROOT = 'static'
Run python manage.py collectstatic
, which will copy the Django admin static files to /path/to/project/static/
Configure your static file server. If you use Nginx, you could add this config:
location /static/ {
alias /path/to/project/static/;
expires modified +1w;
}
Reload your web server
You should now have access to the static files.
Also make sure that AppDirectoriesFinder is not commented, happens when you're trying to customize your own app structure. Unfortunatelly it's pointless to seek such information in official docs.
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
]
in my project, the solution is in settings.py
, set:
DEBUG = False # debug false mod not working css
In settings.py Don't use tuple for the
STATICFILES_DIRS =( os.path.join(BASE_DIR, 'static'), )
you should use list,like this
STATICFILES_DIRS =[ os.path.join(BASE_DIR, 'static'), ]
One solution might be to add your local IP to the ALLOWED_HOSTS
list in settings.py
e.g.
CURRENT_IP = '192.168.0.123'
ALLOWED_HOSTS = ['127.0.0.1', 'localhost', '0.0.0.0', CURRENT_IP]