【发布时间】:2015-12-12 20:11:20
【问题描述】:
我正在使用 Cloud 9 IDE 构建网站。我的目标是从站点根目录“/index.html”等提供静态网站。此站点中的内容将按计划重新生成(在此示例中为每天)。在“/admin”和“/api”端点,我想提供几个烧瓶应用程序。
因为这是在 Cloud 9 IDE 上构建的,所以我无权访问代理服务器配置。我必须使用 HTML 协议将所有内容提供给一个端口。 uWSGI 能够做到这一点。不过,我正在为我的配置文件苦苦挣扎:
#uwsgi.ini
[uwsgi]
static-index = index.html
static-map2 = /=/home/ubuntu/workspace/generated-site
static-map2 = /static=/home/ubuntu/workspace/static-assets
mount = /admin=admin.py
mount = /api=api.py
manage-script-name = true
master = true
processes = 5
socket=0.0.0.0:8080
protocol=http
对 /admin 和 /api 的请求按预期工作,返回结果或 404 错误。
对/ 和/index.html 的请求都按预期返回generated-site/index.html。
对/no_exist.html 的请求按预期返回404 Not Found。
我的问题是第二个static-map2。对/static/test.html 的请求返回404 Not Found(我在其中放置了一个html 文件进行测试)。
【问题讨论】:
-
任何有兴趣的人应该可以看到一个演示应用程序@ide.c9.io/cstrutton/test-uwsgi
-
对于可能需要这个的人,我想通了... /static/test.html 提供 static-assets/static/test.html
标签: python flask uwsgi cloud9-ide