gpt4 book ai didi

django - gunicorn:错误:参数--error-logfile/--log-file:预期一个参数

转载 作者:行者123 更新时间:2023-12-04 18:44:43 26 4
gpt4 key购买 nike

我正在尝试制作一个 gunicorn bash 可执行文件来运行 django 服务器,但出现错误 - gunicorn: error: argument --error-logfile/--log-file: expected one argument .

它与 - gunicorn bekaim_pre_registration.wsgi:application --bind 0.0.0.0:8001 一起工作正常
但 bash 文件出错。

这是我的 - gunicorn_start.bash

#!/bin/bash

NAME="django_app" # Name of the application
DJANGODIR=/home/ubuntu/bekaim_pre_registration # Django project directory
SOCKFILE=/home/ubuntu/django_env/run/gunicorn.sock # we will communicte using this unix socket
USER=ubuntu # the user to run as
GROUP=ubuntu # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=bekaim_pre_registration.settings # which settings file should Django use
DJANGO_WSGI_MODULE=bekaim_pre_registration.wsgi # WSGI module name
echo "Starting $NAME as `whoami`"

# Activate the virtual environment

cd $DJANGODIR
source /home/ubuntu/django_env/bin/activate
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DJANGODIR:$PYTHONPATH

# Create the run directory if it doesn't exist

RUNDIR=$(dirname $SOCKFILE)
test -d $RUNDIR || mkdir -p $RUNDIR

# Start your Django Unicorn
# Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)

exec gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $NUM_WORKERS \
--user=$USER --group=$GROUP \
--bind=unix:$SOCKFILE \
--log-level=debug \
--log-file

使该脚本可执行。
$ sudo chmod u+x gunicorn_start.bash

当我测试 - ./gunicorn_start.bash
Starting django_app as ubuntu
usage: gunicorn [OPTIONS] [APP_MODULE]
gunicorn: error: argument --error-logfile/--log-file: expected one argument

我正在关注本教程 - https://jee-appy.blogspot.com/2017/01/deply-django-with-nginx.html

任何人都可以帮忙吗?

最佳答案

实际上日志文件没有在配置中定义 -

#!/bin/bash

NAME="django_app" # Name of the application
DJANGODIR=/home/ubuntu/bekaim_pre_registration # Django project directory
SOCKFILE=/home/ubuntu/django_env/run/gunicorn.sock # we will communicte using this unix socket
USER=ubuntu # the user to run as
GROUP=ubuntu # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=bekaim_pre_registration.settings # which settings file should Django use
DJANGO_WSGI_MODULE=bekaim_pre_registration.wsgi # WSGI module name
echo "Starting $NAME as `whoami`"

# Activate the virtual environment

cd $DJANGODIR
source /home/ubuntu/django_env/bin/activate
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DJANGODIR:$PYTHONPATH

# Create the run directory if it doesn't exist

RUNDIR=$(dirname $SOCKFILE)
test -d $RUNDIR || mkdir -p $RUNDIR

# Start your Django Unicorn
# Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)

exec gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $NUM_WORKERS \
--user=$USER --group=$GROUP \
--bind=unix:$SOCKFILE \
--log-level=debug \
--log-file=-

关于django - gunicorn:错误:参数--error-logfile/--log-file:预期一个参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54531088/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com