Django增加admin后台管理:
0 1 2 3 4 5 6 7 8 9 10 11 12 |
[root@hz Byrd]# python manage.py syncdb #建表、设置管理员 [root@hz Byrd]# cat Byrd/urls.py urlpatterns = patterns('', # Examples: # url(r'^$', '{{ project_name }}.views.home', name='home'), # url(r'^{{ project_name }}/', include('{{ project_name }}.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), #将admin注释去掉 ) |
访问:http://mydomain/admin发现样式不正确,/static/admin/css/base.css这样的样式报404未找到错误!
继续测试:python manage.py runserver 0.0.0.0:8080 发现不经过nginx,样式是被加载的。SourceByrd's Weblog-https://note.t4x.org/system/nginx-django-admin/
解决方法:
0 1 2 |
location /static/ { alias /python目录/site-packages/django/contrib/admin/static/; } |
参考:http://www.cnblogs.com/fnng/p/3737964.html
参考:http://www.zhaofengcao.com/archives/2043
参考:http://wangye.org/blog/archives/572/
参考:http://blog.csdn.net/fengyu09/article/details/17923737
参考:http://lidongbest5.com/blog/1/
参考:http://django-chinese-docs.readthedocs.org/en/latest/intro/tutorial02.html
参考:http://www.educity.cn/wenda/117371.htmlSourceByrd's Weblog-https://note.t4x.org/system/nginx-django-admin/ SourceByrd's Weblog-https://note.t4x.org/system/nginx-django-admin/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!