python - 尝试在 Ubuntu 18.04 上运行 Django、Redis、Celery 和 Supervisor 但无法正常工作
问题描述
嗨,我做了一个应用程序,我可以在其中提取数据并在我的网站上实时显示。
在本地,当我运行以下命令时它工作得很好:
celery -A proj_name beat -l INFO
celery -A proj_name worker -l INFO -p gevent
我使用 gevent 因为我在 Windows 上。在 Ubuntu 服务器上,我认为我不需要它。
所以现在在服务器上,我已经按照下面的文章来信:
https://realpython.com/asynchronous-tasks-with-django-and-celery/#running-remotely
当我到达最后一部分时:
sudo supervisorctl start pichacelery
它给了我以下错误:
bscscanapicelery: ERROR (no such file)
这些是我的文件:
bscscanapi_celery.conf
; ==================================
; celery worker supervisor example
; ==================================
; the name of your supervisord program
[program:bscscanapicelery]
; Set full path to celery program if using virtualenv
command=/home/djangoadmin/.virtualenvs/bscscanapi/bin/celery worker -A bscscanapi --loglevel=INFO
; The directory to your Django project
directory=/home/djangoadmin/stalker-nichan/bscscanapi
; If supervisord is run as the root user, switch users to this UNIX user account
; before doing any processing.
user=djangoadmin
; Supervisor will start as many instances of this program as named by numprocs
numprocs=1
; Put process stdout output in this file
stdout_logfile=/var/log/celery/bscscanapi_worker.log
; Put process stderr output in this file
stderr_logfile=/var/log/celery/bscscanapi_worker.log
; If true, this program will start automatically when supervisord is started
autostart=true
; May be one of false, unexpected, or true. If false, the process will never
; be autorestarted. If unexpected, the process will be restart when the program
; exits with an exit code that is not one of the exit codes associated with this
; process’ configuration (see exitcodes). If true, the process will be
; unconditionally restarted when it exits, without regard to its exit code.
autorestart=true
; The total number of seconds which the program needs to stay running after
; a startup to consider the start successful.
startsecs=10
; Need to wait for currently executing tasks to finish at shutdown.
; Increase this if you have very long running tasks.
stopwaitsecs = 600
; When resorting to send SIGKILL to the program to terminate it
; send SIGKILL to its whole process group instead,
; taking care of its children as well.
killasgroup=true
; if your broker is supervised, set its priority higher
; so it starts first
priority=998
bscscanapi_celerybeat.conf
; ================================
; celery beat supervisor example
; ================================
; the name of your supervisord program
[program:bscscanapicelerybeat]
; Set full path to celery program if using virtualenv
command=/home/djangoadmin/.virtualenvs/bscscanapi/bin/celery beat -A bscscanapi --loglevel=INFO
; The directory to your Django project
directory=/home/djangoadmin/stalker-nichan/bscscanapi
; If supervisord is run as the root user, switch users to this UNIX user account
; before doing any processing.
user=djangoadmin
; Supervisor will start as many instances of this program as named by numprocs
numprocs=1
; Put process stdout output in this file
stdout_logfile=/var/log/celery/bscscanapi_beat.log
; Put process stderr output in this file
stderr_logfile=/var/log/celery/bscscanapi_beat.log
; If true, this program will start automatically when supervisord is started
autostart=true
; May be one of false, unexpected, or true. If false, the process will never
; be autorestarted. If unexpected, the process will be restart when the program
; exits with an exit code that is not one of the exit codes associated with this
; process’ configuration (see exitcodes). If true, the process will be
; unconditionally restarted when it exits, without regard to its exit code.
autorestart=true
; The total number of seconds which the program needs to stay running after
; a startup to consider the start successful.
startsecs=10
; if your broker is supervised, set its priority higher
; so it starts first
priority=999
解决方案
推荐阅读
- kubernetes - 如何在 Kubernetes 中使用 Apache ActiveMQ Artemis
- reactjs - 如何在 react-admin 中的按钮单击回调中调用反应钩子,或者该怎么做?
- asp.net - ASP.NET core 3 使用 jwt 自定义身份验证
- android - 需要多长时间才能在 google play 上批准我的应用?
- java - java中的批量插入
- php - Wordpress 税务查询问题 - 如何按分类、特定父项和子项查询?
- r - 使用 filter_at 正确过滤一些数据
- php - 如何在同一子类别中为 Woocommerce 产品添加“上一个/下一个”产品链接
- python - Python的unittest,通过输入通过测试
- python - Python GraphQL 查询问题