I am new to django
and currently I am making the tutorial. It goes well but every time at some point my admin site loses ist CSS styling and starts looking like this:
This problem is apparently not new, as I found few posts here (e.g., this one or this one) on the topic. Following the answers I made the next steps:
- Running
python manage.py collectstatic
Modifying
settings.py
:STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static')
Adding the following lines to
manage.py
:import mimetypes mimetypes.init() mimetypes.types_map['.css'] = 'text/css'
Going sure that
'django.contrib.staticfiles'
insettings.py
is uncommented.
Nevertheless, nothing worked and my admin site still does not have CSS styling.
Note that in my case the problem is not consistent. Whenever I start a new project, the admin page is fine. The problem appears only after certain (and each time different) step throughout the tutorial. For example, last time it was after I modified the DATABASES
entry in settings.py
(though I went through this step smoothly one attempt before; changing the entry to its original value did not help to restore the admin page styling).
I am using django 1.9.6
with python 3.4.3
under Ubuntu 14.04
.
EDIT:
I am running server with #DEBUG = True
and ALLOWED_HOSTS = ['*']