Default Django 1.5 admin css not working

2019-02-18 17:24发布

I just installed my django 1.5 app on ec2 and right now the /admin portion of the site doesn't have css. Is there a way that I can configure this?

Just to add to this the css files are located in the following folder: /usr/local/lib/python2.6/dist-packages/django/contrib/admin/static/admin/css$

3条回答
劫难
2楼-- · 2019-02-18 17:53

I had exactly the same problem and I think I figured it out how to solve it. Actually it's not that hard. All you need to modify is your settings.py(STATIC_ROOT and STATIC_URL) and server config file (url alias). I wrote a short blog post with 3 steps. http://www.ycshao.com/?p=898.

查看更多
The star\"
3楼-- · 2019-02-18 17:57

How did you configure it? For admin app to load static files, you need to create a symbolic link inside your app's static directory. Have you done this?

ls -l should give something like:

admin -> /usr/local/lib/python2.6/dist-packages/django/contrib/admin/media
查看更多
甜甜的少女心
4楼-- · 2019-02-18 18:16

dragon and ycshao have great answers. Just want to add that if you are running Apache server 2.4+. Instead of

Allow from all

You should use

Require all granted

It solved my static file hosting issue.

查看更多
登录 后发表回答