用uwsgi运行猎鹰APP

时间:2014-06-06 18:06:14

标签: python python-2.7 python-3.x uwsgi falconframework

我刚开始学习猎鹰(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运行这个示例应用程序。但我不知道怎么做。

我按照http://falcon.readthedocs.org/en/latest/user/install.html

的建议安装了pip install uwsgi gevent

但是现在呢。有人指导我。

2 个答案:

答案 0 :(得分:7)

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

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

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

答案 1 :(得分:0)

You can use uwsgi.ini to store configuration and easy run. Good way to setup uwsgi as services. Configuration with 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

and run in app folder:

uwsgi uwsgi.ini

command with virtualenv

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