I have a Pyramid application that I am loading with Gunicorn. My ini file has the following:
[app:main]
use = egg:my_example
...
[server:main]
use = egg:gunicorn
host = localhost
port = 5900
workers = 1
worker_class = gevent
I start Gunicorn witn:
gunicorn --paste ./development.ini
So my application is available at http://127.0.0.1:5900
What do I need to to do so my application is available in other path rather than / ,for example at http://127.0.0.1:5900/my_example
I saw the following posts: pyramid pserve in different root path than / and Pyramid: how to set SCRIPT_NAME in request.environ but I'm still not able to do it
答案 0 :(得分:0)
Rutter是正确的答案(例如,http://127.0.0.1:5900/my_example/foo/bar
导航至应用程序中的/foo/bar
路由)。这似乎就是您要描述的内容,https://stackoverflow.com/a/43506460/704327中的ini代码段就足够了。 Rutter还将正确准备环境,以便在使用/my_example
和request.route_path
时,您的应用将生成带有request.route_url
前缀的正确URL。