如何将Systemd用于Django-q守护程序 [英] How to use Systemd for Django-q daemon
本文介绍了如何将Systemd用于Django-q守护程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将Django-Q用于任务队列和调度程序.我需要继续运行以下命令: python manage.py qcluster.
我该如何使用Systemd?
I use Django-Q for task queue and scheduler. I need to keep running the command: python manage.py qcluster.
How can I do it with Systemd?
我已经找到了用于.service文件的代码,但是我不知道如何将我的Virtualenv用于python路径:
I've found this code for .service file but I don't know how to use my Virtualenv for python path:
[Unit]
Description=Async tasks runner
After=network.target remote-fs.target
[Service]
ExecStart=/usr/bin/django-admin qcluster --pythonpath /path/to/project --settings settings
User=apache
Restart=always
[Install]
WantedBy=multi-user.target
推荐答案
使用安装在virtualenv的 bin
目录或 python中的
二进制文件在那里,可以在项目的工作目录中运行 django-admin
二进制文件 manage.py
:
Use the django-admin
binary installed in your virtualenv's bin
directory, or the python
binary there to run manage.py
within your project's working directory:
ExecStart=/path/to/my-venv/bin/django-admin qcluster --pythonpath /path/to/project --settings settings
或
ExecStart=/path/to/my-venv/bin/python manage.py qcluster --pythonpath /path/to/project --settings settings
RootDirectory=/path/to/project
这篇关于如何将Systemd用于Django-q守护程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文