Django1.6 后台管理界面美化

美化工具:django-grappelli

参考资料:http://django-grappelli.readthedocs.org/en/2.5.4/quickstart.html#installation

源码:https://github.com/sehmaschine/django-grappelli/tree/dev/2.5.x

安装步骤:

    1.Django 1.6 适用版本:

           Grappelli 2.5.4 (September 9th, 2014): Compatible with Django 1.6

    2.源码安装

       unzip django-grappelli-dev-2.5.x.zip

       python setup.py install

    3.修改配置

    <1>设置settings.py中    

            INSTALLED_APPS = (

                'grappelli',#这里grapplli 必须位于django.contrib.admin之前

                'django.contrib.admin',

                'django.contrib.auth',

                'django.contrib.contenttypes',

                'django.contrib.sessions',

                'django.contrib.messages',

                'django.contrib.staticfiles',

                'monitor',

            )

       import os   

        SITE_ROOT=os.path.join(os.path.abspath(os.path.dirname(__file__)),'..') #变量值项目的根目录,也就是settings.py的存放位置

        STATIC_ROOT = os.path.join(SITE_ROOT,'static')

        STATICFILES_FINDERS = (

            'django.contrib.staticfiles.finders.AppDirectoriesFinder',

            'django.contrib.staticfiles.finders.FileSystemFinder',

        )

      说明:

      SITE_ROOT就是myproject/myproject的路径。

   <2>设置urls.py          

        urlpatterns = patterns('',

            # Examples:

            # url(r'^$', 'fort.views.home', name='home'),

            # url(r'^blog/', include('blog.urls')),

            url(r'^grappelli/', include('grappelli.urls')), # grappelli URLS

            url(r'^admin/', include(admin.site.urls)),

        )

       grapplli的url映射,必须在admin之前

    <3>收集静态资源

          python manage.py collectstatic       

            此命令,收集grapplli app目录下的static目录中的所有静态资源(CSS,js,images)到你配置的STATIC目录下的grapplli目录下去.

    <4>启动django

          nohup python manage.py runserver 0.0.0.0:8000>/tmp/nohup.out &


你可能感兴趣的:(Django1.6,后台管理界面)