Django管理仪表盘CSS丢失

时间:2019-12-10 18:36:39

标签: python django deployment

我刚刚将应用程序部署到DigitalOcean。尽管我使用过nginx,但一切都运行良好,excep管理面板的样式。这是我的代码:

settings.py

STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(BASE_DIR, "static_root")

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, "static"),
]

nginx配置:

server {
    listen 80;
    server_name server_domain_or_IP;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static_root/ {
        root /home/my_username/myproject;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/home/my_username/myproject/myproject.sock;
    }
}

0 个答案:

没有答案