简体   繁体   English

无法使用球童 + django + gunicorn 提供 static 文件

[英]cannot serve static files using caddy + django + gunicorn

I'm working on a project that's using caddy as a web server and proxy, django as the backend, and gunicorn as the wsgi.我正在开发一个项目,该项目使用 caddy 作为 web 服务器和代理,django 作为后端,gunicorn 作为 wsgi。 But everything all works well except I can't serve the static files.但除了我无法提供 static 文件外,一切都运行良好。

This is my Caddyfile.这是我的球童档案。

mydomain.com {
    root * /path/to/staticfile/
    file_server
    encode zstd gzip
    @notstatic {
        not path /path/to/staticfile/*
    }
    reverse_proxy @notstatic app:8000
}

Is there anything wrong that I have used?我使用有什么问题吗?

How about getting rid of the @notstatic , ie:如何摆脱@notstatic ,即:

mydomain.com {
    root * /path/to/staticfile/
    file_server
    encode zstd gzip
    reverse_proxy app:8000
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM