我有一个小的.py / Flask应用程序,可以从命令行作为uWSGI或Gunicorn Server运行。
Flask的网站显示了一种简单的方法,可以使用这些类型的服务器(即esp)简单地运行Flask应用程序。如果我在venv中使用我的来源。
您知道如何在启动时通过venv运行uWSGI服务器或Gunicorn服务器吗?
我基本上是在运行一些简单的资源来测试Flask应用程序和Python3的服务器。
您知道如何在启动时通过venv运行uWSGI服务器或Gunicorn服务器吗?
您必须创建一个虚拟环境,并将路径硬编码到uWSGI或Gunicorn。
要在引导时启动,使用应用程序systemd或主管。
使用主管的示例。
# content from /etc/supervisor/conf.d/microblog.conf
[program:microblog]
command=/home/ubuntu/microblog/venv/bin/gunicorn -b localhost:8000 -w 4 microblog:app
directory=/home/ubuntu/microblog
user=ubuntu
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
有关详细信息,请查看Miguel的有关在Linux上部署的教程。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句