I am currently learning django
and following the tutorial. Everything is going smoothly, but I keep encountering an issue where my admin site loses its CSS styling and ends up looking like this:
https://i.sstatic.net/YTXET.png
This seems to be a common problem, as I have come across several posts on it (such as this one or this one). Following the suggestions in those posts, I have taken the following steps:
- Executed
python manage.py collectstatic
Modified
settings.py
:STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static')
Added the following lines to
manage.py
:import mimetypes mimetypes.init() mimetypes.types_map['.css'] = 'text/css'
Ensured that
'django.contrib.staticfiles'
insettings.py
is uncommented.
However, none of these solutions worked and my admin site still lacks CSS styling.
It's worth mentioning that this issue is not consistent for me. When starting a new project, the admin page displays correctly. The problem only arises after completing specific (and different each time) steps during the tutorial. For instance, last time it occurred after I made changes to the DATABASES
entry in settings.py
(even though I had executed this step without any issues previously; reverting the entry to its original value did not resolve the styling problem).
I am using django 1.9.6
with python 3.4.3
on Ubuntu 14.04
.
EDIT:
The server is running with #DEBUG = True
and ALLOWED_HOSTS = ['*']