gpt4 book ai didi

django - Gunicorn 启动时抛出 OSError Errno 1

转载 作者:行者123 更新时间:2023-12-04 02:12:32 25 4
gpt4 key购买 nike

我正在尝试使用 Gunicorn/nginx/supervisor 部署 Django 1.5,但在这个阶段,我只是想让 Gunicorn 正常启动。

我正在尝试从命令行开始:

gunicorn project.wsgi:application --workers 3 --user=django --group=django --bind=127.0.0.1:8100

它失败了
OSError: [Errno 1] Operation not permitted: '/tmp/wgunicorn-c7BU9r'

回溯:
2013-11-01 20:03:24 [17860] [INFO] Starting gunicorn 18.0
2013-11-01 20:03:24 [17860] [INFO] Listening at: http://127.0.0.1:8000 (17860)
2013-11-01 20:03:24 [17860] [INFO] Using worker: sync
Traceback (most recent call last):
File "/opt/envs/bedlounge-front/bin/gunicorn", line 9, in <module>
load_entry_point('gunicorn==18.0', 'console_scripts', 'gunicorn')()
File "/opt/envs/bedlounge-front/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 71, in run
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
File "/opt/envs/bedlounge-front/lib/python2.7/site-packages/gunicorn/app/base.py", line 143, in run
Arbiter(self).run()
File "/opt/envs/bedlounge-front/lib/python2.7/site-packages/gunicorn/arbiter.py", line 175, in run
self.manage_workers()
File "/opt/envs/bedlounge-front/lib/python2.7/site-packages/gunicorn/arbiter.py", line 470, in manage_workers
self.spawn_workers()
File "/opt/envs/bedlounge-front/lib/python2.7/site-packages/gunicorn/arbiter.py", line 529, in spawn_workers
self.spawn_worker()
File "/opt/envs/bedlounge-front/lib/python2.7/site-packages/gunicorn/arbiter.py", line 482, in spawn_worker
self.cfg, self.log)
File "/opt/envs/bedlounge-front/lib/python2.7/site-packages/gunicorn/workers/base.py", line 49, in __init__
self.tmp = WorkerTmp(cfg)
File "/opt/envs/bedlounge-front/lib/python2.7/site-packages/gunicorn/workers/workertmp.py", line 25, in __init__
util.chown(name, cfg.uid, cfg.gid)
File "/opt/envs/bedlounge-front/lib/python2.7/site-packages/gunicorn/util.py", line 157, in chown
os.chown(path, uid, gid)
OSError: [Errno 1] Operation not permitted: '/tmp/wgunicorn-c7BU9r'

如果我开始时没有用户和组参数(作为我的普通用户),它开始就好了。我的理解是,我想在另一个用户或组下启动它。

任何人都可以帮助我解决我做错了什么吗?或者任何可以帮助我解决这个问题的信息?

谢谢!

最佳答案

问题可能在于您的用户 ID 试图以其他用户身份启动进程。我假设您已经在操作系统中创建了用户和组。您可以以 root 身份尝试您之前的命令或使用 sudo .

我使用以下 Supervisor 配置,它在命令行和选项中指定用户:

[program:gunicorn]
command=/opt/mysite/virtual_env/bin/python \
/opt/mysite/virtual_env/bin/gunicorn_django -w 2 --user=appsrun
directory = /opt/mysite/virtual_env/app/
user = appsrun

关于django - Gunicorn 启动时抛出 OSError Errno 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19737511/

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