static files not loading only on django admin page
static files not loading only on django admin page
This is on a production server with DEBUG = False. My static files will load on the home page but not the admin page. It gives me a error 404 in the browser console. This only happens on the admin page. I've checked to make sure that the .css files are in the specified directory's and they are along with the code inside them. NOTE: The same server and file structure was working earlier. I've tried almost everything I can think of any help would be greatly appreciated!
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
STATIC_ROOT = '/home/django/django_project/django_project/static/'
STATIC_URL = '/static/'
collectstatic
Yes, I've also tried rebooting and restarting nginx and gunicorn. I've checked where the static files are served from in nginx and the settings.py there're all correct. The reason why I think they're all correct is because all of my other pages load the car fine. Only the admin page doesn't.
– Mason Curtis
Jul 1 at 2:34
Could we see your project's
settings.py
? Particularly the settings related to static content.– Cole
Jul 1 at 2:39
settings.py
I added the code regarding the settings.py
– Mason Curtis
Jul 1 at 2:47
1 Answer
1
I finally figured it out. I set the /static
in nginx config for django but not the path for /static/admin
. Thank you everyone for you help. Happy coding.
/static
/static/admin
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Did you
collectstatic
?– Cole
Jul 1 at 2:26