Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django admin CSS missing, after collecting static, with python manage.py runserver

I run django project on django 1.8.0, with "django manage.py runserver".

It is to be noted that the admin page worked perfectly with CSS a few months ago. However without any change in any file in the project directory (checked with git), the django admin page is missing now its CSS files.

I've noticed that many have had similar problems but I have been unable to solve the problem with their solution. e.g. running manage.py collectstatic.

[13/Dec/2015 00:35:00]"GET /admin/login/?next=/admin/ HTTP/1.1" 200 1931
[13/Dec/2015 00:35:00]"GET /static/admin/css/base.css HTTP/1.1" 200 1591
[13/Dec/2015 00:35:00]"GET /static/admin/css/login.css HTTP/1.1" 200 1591

the css file is accessed, but missing in the browser.

As you can see the css file is accessed normally according to the log, but the css file received by the browser is empty.

Your help would be very appreciated. Thanks.

UDPATE: All the files are given the read access as you can see below! enter image description here

like image 417
zoonoo Avatar asked Dec 12 '15 15:12

zoonoo


1 Answers

You need to enable DEBUG and enable staticfiles app. If you do not want to enable DEBUG, you may run runserver with --insecure commandline parameter.

https://docs.djangoproject.com/en/1.9/ref/contrib/staticfiles/

like image 92
name_no Avatar answered Sep 23 '22 03:09

name_no