使用uwsgi运行Falcon应用程序

2024-06-01 11:01:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我刚开始学猎鹰(http://falcon.readthedocs.org/en/latest/user/quickstart.html) 但它需要一个运行的web服务器和建议使用uwsgi或gunicorn的文档。

尽管他们已经提到了如何与gunicorn一起使用

$ pip install gunicorn  #install
$ gunicorn things:app   #and run app through gunicorn.

但我想用uwsgi运行这个示例应用程序。但我不知道怎么做。

我已经安装了pip install uwsgigevent正如这里建议的http://falcon.readthedocs.org/en/latest/user/install.html

但现在怎么办。有人指引我。


Tags: installpiporgapphttphtmlreadthedocslatest
2条回答

您可能会在uWSGI文档站点上找到您的答案,特别是尝试以下页面: http://uwsgi-docs.readthedocs.org/en/latest/WSGIquickstart.html

我从未使用过Falcon或uWSGI,但看起来你可能可以逃脱:

uwsgi --wsgi-file things.py --callable app

您可以使用uwsgi.ini来存储配置和轻松运行。把uwsgi设置为服务的好方法。使用virtualenv配置

[uwsgi]
http = :8000
chdir = /home/user/www/uwsgi-ini
virtualenv = /home/user/www/uwsgi-ini/venv/
wsgi-file = main.py
callable = app
processes = 4
threads = 2
stats = 127.0.0.1:9191

并在应用程序文件夹中运行:

uwsgi uwsgi.ini

使用virtualenv命令

uwsgi --http :8000 --wsgi-file main.py --callable app -H $(pwd)/venv/

相关问题 更多 >