Django+uwsgi+nginx handling static files for admin

Source: Internet
Author: User

Today using admin background to manage users, because I am using Uwsgi+nginx, static files are managed by Nginx,

The current path is in

/var/www/jastme/static

But the admin's static file is not in this position, then how to do?

First, under the project, there is the directory of manage.py.

Edit the setting.py under the project

First add static_root = '/var/www/jastme/static/'

Restart Uwsgi

Using Python manage.py collectstatic to select Yes, an admin directory will be generated under the static directory

This time we open the admin site, will find static files still loading error, because the path is using an absolute path, that is,/var/www/jastme/xxx, open the browser's debug console will find this problem.

How to Solve,

Open setting.py directly to static_root = '/static/'

Restart Uwsgi

The load is now finally successful.


Django+uwsgi+nginx handling static files for admin

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.