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