您现在的位置是:首页 > 电脑 > 

通过Gunicorn运行manage.py命令(Running manage.py command through Gunicorn)

2025-07-27 15:54:33
通过Gunicorn运行manage.py命令(Running manage.py command through Gunicorn) 我按照本教程设置了Gunicorn在VPS上运行Django,这非常好用,并且Web服务器在ginx上运行。 我创建了一个单独的manage.py命令,我想使用worker运行Async,我不确定如何通过Gunicorn
通过Gunicorn运行manage.py命令(Running manage.py command through Gunicorn)

我按照本教程设置了Gunicorn在VPS上运行Django,这非常好用,并且Web服务器在ginx上运行。

我创建了一个单独的manage.py命令,我想使用worker运行Async,我不确定如何通过Gunicorn集成它。

这是第一个Django启动时运行代码的后续操作,其中建议创建一个单独的manage.py命令,然后通过Gunicorn将其作为单独的工作进程运行。

I followed this tutorial to set up Gunicorn to run Django on a VPS, this is working perfectly fine and the web server is running on ginx.

I created a separate manage.py command that I want to run Async using a worker, I am unsure how to integrate this through Gunicorn.

This is a follow up to Run code on first Django start, where the recommendation was to create a separate manage.py command and then run it as a separate worker process through Gunicorn.

最满意答案

Gunicorn的目的是使用WSGI为Django项目提供服务,它根本不使用manage.py. 您应该直接调用与manage.py相关的任何内容:

$ cd <projectdir> $ source myprojectenv/bin/activate $ python manage.py <your command here>

要将其设置为worker,您可以在virtualenv中设置指向python二进制文件的cron作业,也可以考虑使用您选择的流程管理工具(supervisord,docker等)进行Celery设置。

Gunicorn's purpose here is to serve the Django project using WSGI, it doesn't use manage.py at all. You should call anything related to manage.py directly:

$ cd <projectdir> $ source myprojectenv/bin/activate $ python manage.py <your command here>

For setting it as a worker, you can either set a cron job that points the python binary in the virtualenv or you can cider making a Celery setup with the process management tool (supervisord, docker etc) of your choice.

#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格

本文地址:http://www.dnpztj.cn/diannao/654106.html

相关标签:无
上传时间: 2023-07-28 12:58:21
留言与评论(共有 9 条评论)
本站网友 合欢皮的功效与作用
5分钟前 发表
$ cd <projectdir> $ source myprojectenv/bin/activate $ python manage.py <your command here> For setting it as a worker
本站网友 三牛念什么
4分钟前 发表
I am unsure how to integrate this through Gunicorn. This is a follow up to Run code on first Django start
本站网友 福州隆鼻
24分钟前 发表
然后通过Gunicorn将其作为单独的工作进程运行
本站网友 电影字幕网
24分钟前 发表
我创建了一个单独的manage.py命令
本站网友 天津经济开发区
25分钟前 发表
I followed this tutorial to set up Gunicorn to run Django on a VPS
本站网友 孕妇奶粉什么牌子的好
23分钟前 发表
docker etc) of your choice.
本站网友 电脑回收站不见了
8分钟前 发表
Gunicorn's purpose here is to serve the Django project using WSGI
本站网友 大葱的营养价值
24分钟前 发表
这是第一个Django启动时运行代码的后续操作