I just launched my Django server, and trying to access it through browser, but the layout is broken, how to fix this issue?
Asked
Active
Viewed 176 times
0
-
did you run `python manage.py collectstatic`? related question [1](http://stackoverflow.com/questions/13258087/missing-bootstrap-resources-in-django-rest-framework), [2](http://stackoverflow.com/questions/25375448/django-rest-framework-missing-static-directory) – soooooot Aug 29 '15 at 05:38
-
Your CSS is not being served. – Mark Galloway Aug 29 '15 at 06:16
-
Please edit your question and add your settings.py and urls.py. – zanderle Aug 29 '15 at 07:33
1 Answers
1
Thanks all for your quick response, I just fixed this issue with following method:
Environment: Apache and WSGI
- Add following line to
/etc/apache2/sites-enabled/000-default
Alias /static/ /path/to/mysite.com/static/ <Directory /path/to/mysite.com/static> Require all granted </Directory>
- Add following line to
settings.py
STATIC_ROOT = BASE_DIR + '/static' STATIC_URL = '/static/'
- Run
python manage.py collectstatic
and restart Apache

Yuwen Yan
- 4,777
- 10
- 33
- 63