why my django admin site does not have the css style

后端 未结 19 1937
南笙
南笙 2020-12-02 07:49

I make a Django admin site using Django development version

But it does not have a CSS style :

\"alt

19条回答
  •  借酒劲吻你
    2020-12-02 08:19

    In addition to many of the other answers being useful, I had a problem that hasn't yet been noted. After upgrading from Django 1.3 to 1.6, my static files directory had a broken symbolic link to the django admin static files.

    My settings.py was configured with:

    STATICFILES_DIRS = (
        '/var/www/static/my-dev',
    )
    

    According to this answer,

    Django will now expect to find the admin static files under the URL /admin/.

    I had a symbolic link /var/www/static/my-dev/admin which was set to:

    admin -> /usr/local/lib/python2.7/dist-packages/django/contrib/admin/media/
    

    That location no longer exists in django 1.6, so I updated the link to:

    admin -> /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/
    

    And now my admin site is working properly.

提交回复
热议问题