Resolving the Django Admin Interface style sheet (CSS style) loss problem

Source: Internet
Author: User

I am logged in while configuring the Django self-contained management interface Http://domain.com/admin There is a problem with the style sheet missing in the background, the interface becomes this:

650) this.width=650; "src=" Http://wangye.org/blog/wp-content/uploads/2012/03/20120309165313.png "alt=" Django Admin management interface style missing "/>

System Environment: centos6.5+nginx1.5.9+uwsgi2.0.4+django1.4.9

Nginx configuration file:

server {        listen        80;        server_name  www.omserver.com;         location / {             uwsgi_pass 192.168.202.128:9000;             include uwsgi_params;             uwsgi_param UWSGI_CHDIR /data/www/OMserverweb;             uwsgi_param UWSGI_SCRIPT django_wsgi;             access_log off;        }         location ^~ /static {             root /data/www/omserverweb;        }         location ~* ^.+\. (mpg|avi|mp3|swf|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|txt|tar|mid|midi|wav|rtf|mpeg) $ {             root /data/www/OMserverweb/static;             access_log off;         }    }

Uwsgi configuration file:

[Uwsgi]socket = 0.0.0.0:9000master = Truepidfile =/usr/local/nginx/uwsgi.pidprocesses = 8chdir =/data/www/ Omserverwebpythonpath =/data/wwwprofiler = truememory-report=trueenable-threads=truelogdate=truelimit-as= 6048daemonize=/data/logs/django.log

1. Modificationssettings.pyInStatic_rootThe physical path for your static files, for example, my static files are stored in/data/www/omserverweb/static, first create the static folder under the WWW directory, and finally modify thesettings.pyInStatic_rootPointing/data/www/omserverweb/static

2. Run the python manage.py collectstatic Command, which copies the required static files from the Django resource bundle to the static folder Static_root indicated. This includes the style sheets (styles), images, and scripts (JS) that are necessary for the admin interface.

or copy the file directly to the static directory:

Cp-r/usr/lib/python2.6/site-packages/django/contrib/admin/static/*/data/www/omserverweb/static/

Resources:

http://wangye.org/blog/archives/572/

Resolving the Django Admin Interface style sheet (CSS style) loss problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.