Django backend styles are missing django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without ha

 

Django 3.0 deploys nginx and uswsgi.ini and logs in to the background management http://127.0.0.1/admin. The style is invalid.

报错:django.core.exceptions.ImproperlyConfigured: You’re using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path
 

Set in setting.py

DEBUG = False # Turn off debug mode
 
ALLOWED_HOSTS = ['*']

Add at the end of setting

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR,'static')


Then in the project directory, execute the command and say yes.

python manage.py collectstatic


Style restored.

 

Guess you like

Origin blog.csdn.net/weixin_47649808/article/details/125949731