Hello!
I upgraded my Django version from 4.1.7 to 4.2.1 on a remote deployment, and it seems that the CSS (for the admin page in particular) from the old installation persists despite running collectstatic
after installing the new Django version. What are my options to fix this? My deployment is at this time not small, so I’m hoping there’s an easier way than creating a new project and moving all of it over.
For clarity, the server is indeed serving statics and I’ve verified this in the browser’s network/console with HTTP 200 for all the .css/.js files, and I’ve force-refreshed of course. I’m using the drf-spectacular
package and the swagger endpoint loads all CSS just fine, so I’m speculating that my broken admin page is due to not-4.2 CSS files.
EDIT:
Upon further research and inspection – the CSS files in my application directory are indeed updated, but whenever I run collectstatic
the files that end up in STATICROOT
aren’t the same ones that are in my application directory (app/staticfiles/admin/css/
).
grax@remote:/var/www/pt/static$ rm -rf admin
grax@remote:~/django$ python3 manage.py collectstatic
[...]
125 static files copied to '/var/www/pt/static', 47 unmodified.
grax@remote:~/django$ cd /var/www/pt/static/admin/css
grax@remote:/var/www/pt/static/admin/css$ ls -l
total 120
-rw-r--r-- 1 grax grax 9114 Jun 1 23:21 autocomplete.css
-rw-r--r-- 1 grax grax 21207 Jun 1 23:21 base.css
-rw-r--r-- 1 grax grax 6584 Jun 1 23:21 changelists.css
-rw-r--r-- 1 grax grax 2929 Jun 1 23:21 dark_mode.css
-rw-r--r-- 1 grax grax 441 Jun 1 23:21 dashboard.css
-rw-r--r-- 1 grax grax 8953 Jun 1 23:21 forms.css
-rw-r--r-- 1 grax grax 958 Jun 1 23:21 login.css
-rw-r--r-- 1 grax grax 2694 Jun 1 23:21 nav_sidebar.css
-rw-r--r-- 1 grax grax 18533 Jun 1 23:21 responsive.css
-rw-r--r-- 1 grax grax 1785 Jun 1 23:21 responsive_rtl.css
-rw-r--r-- 1 grax grax 4694 Jun 1 23:21 rtl.css
drwxrwxr-x 3 grax grax 4096 Jun 1 23:21 vendor
-rw-r--r-- 1 grax grax 11900 Jun 1 23:21 widgets.css
But:
grax@remote:~/django/app/staticfiles/admin/css$ ls -l
total 116
-rw-rw-r-- 1 grax grax 9114 May 19 16:42 autocomplete.css
-rw-rw-r-- 1 grax grax 20344 May 19 16:42 base.css
-rw-rw-r-- 1 grax grax 6395 May 19 16:42 changelists.css
-rw-rw-r-- 1 grax grax 796 May 19 16:42 dark_mode.css
-rw-rw-r-- 1 grax grax 380 May 19 16:42 dashboard.css
-rw-rw-r-- 1 grax grax 423 May 19 16:42 fonts.css
-rw-rw-r-- 1 grax grax 8944 May 19 16:42 forms.css
-rw-rw-r-- 1 grax grax 958 May 19 16:42 login.css
-rw-rw-r-- 1 grax grax 2619 May 19 16:42 nav_sidebar.css
-rw-rw-r-- 1 grax grax 18854 May 19 16:42 responsive.css
-rw-rw-r-- 1 grax grax 1741 May 19 16:42 responsive_rtl.css
-rw-rw-r-- 1 grax grax 3598 May 19 16:42 rtl.css
drwxrwxr-x 3 grax grax 4096 May 19 16:42 vendor
-rw-rw-r-- 1 grax grax 11297 May 19 16:42 widgets.css
``
So there’s a fonts.css
in the app directory that collectstatic
ignores, that the other CSS files query. And the file sizes in STATICROOT
are different for some reason.
Browser console/network: