本文介绍了与主管建立pipenv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想部署开发服务器,但是启动芹菜和马尼康时遇到了问题.我出于目的使用脚本

I want to deploy dev server but I have a problem with starting celery and gunicorn. I'm using scripts for my purposes

celery.sh

celery.sh

#!/bin/bash
cd /home/dev/app
pipenv run celery -A config worker -B -l info

然后输入start.sh来获取Gunicorn

and start.sh for gunicorn

#!/bin/bash
cd /home/dev/app
pipenv run gunicorn config.wsgi:application -b 127.0.0.1:8005 -w 2 -t 60 \

    --env DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE \

    --env DSN=$SENTRY_DSN \

    --env DATABASE_URL=$DATABASE_URL \

    --log-file - \

    --error-logfile /home/dev/app/errors.log

这也是我的主管配置

[program:back]
directory=/home/dev/app/
command=/home/dev/bin/start
user=dev
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
stopasgroup=true
killasgroup=true


[program:celery]
directory=/home/dev/app/
command=/home/dev/bin/celery
user=dev
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
stopasgroup=true
killasgroup=true

当我运行sudo supervisorctl start celery时,出现以下错误:/home/dev/bin/celery: line 3: pipenv: command not found

When I'm running sudo supervisorctl start celery I'm getting the following error:/home/dev/bin/celery: line 3: pipenv: command not found

我还添加了以下行,如pipenv文档所述( https://pipenv.readthedocs. io/en/latest/diagnose/)

Also I added the following lines as pipenv documentation says (https://pipenv.readthedocs.io/en/latest/diagnose/)

[supervisord]
environment=LC_ALL='en_US.UTF-8',LANG='en_US.UTF-8'

更新

更改了我的主管配置:

UPDATE

Changed my supervisor config:

[program:back]
directory=/home/dev/app/
command=pipenv run gunicorn config.wsgi:application --bind 127.0.0.1:8005
user=dev
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
stopasgroup=true
killasgroup=true


[program:celery]
directory=/home/dev/app/
command=pipenv run celery -A config:celery_app worker -B -l info
user=dev
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
stopasgroup=true
killasgroup=true

现在我遇到一个错误:

back: ERROR (no such file)

推荐答案

您需要提供明确的gunicorn路径.尽管我不确定pipenv,但您遇到的错误是因为主管试图在目录中找到gunicorn.您应该将配置文件更改为以下内容:

You need to give explicit path of gunicorn. Though I'm not sure about pipenv, but the error you are getting is because supervisor tries to find gunicorn in the directory. You should change your config file into something like this:

[program:back]
directory=/home/dev/app/
command=/path/to/pipenv run /path/to/gunicorn config.wsgi:application --bind 127.0.0.1:8005

然后,您必须重新启动超级用户才能加载设置.

Then you must restart your supervisord in order to load the settings.

这篇关于与主管建立pipenv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-14 14:17