Help: Django 4.2 admin page CSS issue

Thank you for clarifying. I was unaware that static files should be moved outside of the Django project directory in production.

Hi, does anybody have an idea. In Test, I am

Django 4.2.1
Nginx serving the admin static files

Static files are all loaded in the browser, and available, no errors,

Still the admin pages are using the user agent sheet which messes up the styling and usability

In case anyone comes across this thread like I did while debugging…

I was running a Django instance via nginx and had upgraded the version of Django several major/minor versions and observed 404s on several admin static files. My Django root directory’s static files contained the files that were showing up as not found.

This was caused by the nginx config looking in the wrong location:

# Proxy the static assests for the Django Admin panel
location /static/admin {
   alias /usr/lib/python3/dist-packages/django/contrib/admin/static/admin/;

Which contained old static files incompatible with the newer version of Django.

The correct solution was to upgrade Django globally, or if that’s not possible, update the config to point at the correct location.

Welcome @tomwalters !

Actually, if you’re properly deploying Django using collectstatic, then this wouldn’t be necessary. The static admin resources would be collected like the rest of the static resources and copied to STATIC_ROOT.

The admin app is an app, like every other app. There is no reason to manage it differently.

Hi Ken, I recently created a django project which includes a wsgi web server. I’m trying to deploy it to an aws ec2 instance (t2.micro ubuntu) but after lots of trying and back and forth the server can’t find the static files used for the django admin, please assist

Welcome @angellox7 !

Please specify how you’re running your project, and the configuration you are using with the web server for your static files.

Also, see the responses and threads at: