Gunicorn 在 Synology 任务计划程序中不工作
Gunicorn not working in Synology task Scheduler
我正在尝试 运行 在我的 synology ds214se nas 上使用 gunicorn 的网站。当我通过 ssh(Putty) 运行 gunicorn 时,它可以完美地工作,但是当我尝试使用 Synology Task Scheduler 运行 它时,无论我尝试什么,它似乎都不起作用。
错误日志如下:
[2021-04-19 22:00:11 +0200] [15979] [DEBUG] Current configuration:
config: config.py
wsgi_app: None
bind: ['192.168.0.80:57831']
backlog: 64
workers: 1
worker_class: sync
threads: 1
worker_connections: 1000
max_requests: 0
max_requests_jitter: 0
timeout: 90
graceful_timeout: 30
keepalive: 2
limit_request_line: 4094
limit_request_fields: 100
limit_request_field_size: 8190
reload: False
reload_engine: auto
reload_extra_files: []
spew: False
check_config: False
print_config: False
preload_app: False
sendfile: None
reuse_port: False
chdir: /volume1/python/wunschzettel
daemon: False
raw_env: []
pidfile: None
worker_tmp_dir: None
user: 1024
group: 100
umask: 0
initgroups: False
tmp_upload_dir: None
secure_scheme_headers: {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'}
forwarded_allow_ips: ['127.0.0.1']
accesslog: None
disable_redirect_access_to_syslog: False
access_log_format: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"
errorlog: -
loglevel: debug
capture_output: False
logger_class: gunicorn.glogging.Logger
logconfig: None
logconfig_dict: {}
syslog_addr: udp://localhost:514
syslog: False
syslog_prefix: None
syslog_facility: user
enable_stdio_inheritance: False
statsd_host: None
dogstatsd_tags:
statsd_prefix:
proc_name: None
default_proc_name: wsgi:app
pythonpath: /volume1/python/wunschzettel/
paste: None
on_starting: <function OnStarting.on_starting at 0x1cf4e58>
on_reload: <function OnReload.on_reload at 0x1cf0050>
when_ready: <function WhenReady.when_ready at 0x1cf5d58>
pre_fork: <function Prefork.pre_fork at 0x1cf64c0>
post_fork: <function Postfork.post_fork at 0x1cf6cc0>
post_worker_init: <function PostWorkerInit.post_worker_init at 0x1cf7430>
worker_int: <function WorkerInt.worker_int at 0x1cf7b80>
worker_abort: <function WorkerAbort.worker_abort at 0x1cf8328>
pre_exec: <function PreExec.pre_exec at 0x1cf73d8>
pre_request: <function PreRequest.pre_request at 0x1cf91e0>
post_request: <function PostRequest.post_request at 0x1cf9920>
child_exit: <function ChildExit.child_exit at 0x1cfa118>
worker_exit: <function WorkerExit.worker_exit at 0x1cfa880>
nworkers_changed: <function NumWorkersChanged.nworkers_changed at 0x1cf9188>
on_exit: <function OnExit.on_exit at 0x1cfb878>
proxy_protocol: False
proxy_allow_ips: ['127.0.0.1']
keyfile: None
certfile: None
ssl_version: 2
cert_reqs: 0
ca_certs: None
suppress_ragged_eofs: True
do_handshake_on_connect: False
ciphers: None
raw_paste_global_conf: []
strip_header_spaces: False
[2021-04-19 22:00:11 +0200] [15979] [INFO] Starting gunicorn 20.1.0
[2021-04-19 22:00:11 +0200] [15979] [DEBUG] Arbiter booted
[2021-04-19 22:00:11 +0200] [15979] [INFO] Listening at: http://192.168.0.80:57831 (15979)
[2021-04-19 22:00:11 +0200] [15979] [INFO] Using worker: sync
[2021-04-19 22:00:11 +0200] [16002] [INFO] Booting worker with pid: 16002
[2021-04-19 22:00:11 +0200] [15979] [DEBUG] 1 workers
[2021-04-19 22:00:14 +0200] [16002] [DEBUG] GET /
[2021-04-19 22:00:14 +0200] [16002] [ERROR] Error handling request /
Traceback (most recent call last):
File "/volume1/homes/admin/.local/lib/python3.8/site-packages/gunicorn/workers/sync.py", line 136, in handle
self.handle_request(listener, req, client, addr)
File "/volume1/homes/admin/.local/lib/python3.8/site-packages/gunicorn/workers/sync.py", line 169, in handle_request
resp, environ = wsgi.create(req, client, addr,
File "/volume1/homes/admin/.local/lib/python3.8/site-packages/gunicorn/http/wsgi.py", line 183, in create
path_info = path_info.split(script_name, 1)[1]
IndexError: list index out of range
[2021-04-19 22:01:11 +0200] [16002] [DEBUG] Closing connection.
[2021-04-19 22:01:11 +0200] [16002] [DEBUG] GET /
[2021-04-19 22:01:11 +0200] [16002] [ERROR] Error handling request /
Traceback (most recent call last):
File "/volume1/homes/admin/.local/lib/python3.8/site-packages/gunicorn/workers/sync.py", line 136, in handle
self.handle_request(listener, req, client, addr)
File "/volume1/homes/admin/.local/lib/python3.8/site-packages/gunicorn/workers/sync.py", line 169, in handle_request
resp, environ = wsgi.create(req, client, addr,
File "/volume1/homes/admin/.local/lib/python3.8/site-packages/gunicorn/http/wsgi.py", line 183, in create
path_info = path_info.split(script_name, 1)[1]
IndexError: list index out of range
任务计划程序命令:
cd /volume1/python/wunschzettel
/volume1/@entware-ng/opt/bin/python3 -m gunicorn -c config.py wsgi:app
注意:我使用完全相同的命令和用户,以及 putty 和调度程序。
请帮我 运行 gunicorn 使用任务调度程序。
我遇到了类似的问题并进行了故障排除。我创建了一个包含两行的起始文件:
export >> "/volume1/web/prod/vars.txt"
/volume1/@appstore/py3k/usr/local/bin/gunicorn -b 0.0.0.0:5010 fl002:app
然后我 运行 通过 SSH 和调度程序。我发现了差异并将其隔离到:
SCRIPT_NAME="/webapi/entry.cgi"
如果我将 Script_name 设置为 ""
,那么问题就不会再出现了。
我正在尝试 运行 在我的 synology ds214se nas 上使用 gunicorn 的网站。当我通过 ssh(Putty) 运行 gunicorn 时,它可以完美地工作,但是当我尝试使用 Synology Task Scheduler 运行 它时,无论我尝试什么,它似乎都不起作用。 错误日志如下:
[2021-04-19 22:00:11 +0200] [15979] [DEBUG] Current configuration:
config: config.py
wsgi_app: None
bind: ['192.168.0.80:57831']
backlog: 64
workers: 1
worker_class: sync
threads: 1
worker_connections: 1000
max_requests: 0
max_requests_jitter: 0
timeout: 90
graceful_timeout: 30
keepalive: 2
limit_request_line: 4094
limit_request_fields: 100
limit_request_field_size: 8190
reload: False
reload_engine: auto
reload_extra_files: []
spew: False
check_config: False
print_config: False
preload_app: False
sendfile: None
reuse_port: False
chdir: /volume1/python/wunschzettel
daemon: False
raw_env: []
pidfile: None
worker_tmp_dir: None
user: 1024
group: 100
umask: 0
initgroups: False
tmp_upload_dir: None
secure_scheme_headers: {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'}
forwarded_allow_ips: ['127.0.0.1']
accesslog: None
disable_redirect_access_to_syslog: False
access_log_format: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"
errorlog: -
loglevel: debug
capture_output: False
logger_class: gunicorn.glogging.Logger
logconfig: None
logconfig_dict: {}
syslog_addr: udp://localhost:514
syslog: False
syslog_prefix: None
syslog_facility: user
enable_stdio_inheritance: False
statsd_host: None
dogstatsd_tags:
statsd_prefix:
proc_name: None
default_proc_name: wsgi:app
pythonpath: /volume1/python/wunschzettel/
paste: None
on_starting: <function OnStarting.on_starting at 0x1cf4e58>
on_reload: <function OnReload.on_reload at 0x1cf0050>
when_ready: <function WhenReady.when_ready at 0x1cf5d58>
pre_fork: <function Prefork.pre_fork at 0x1cf64c0>
post_fork: <function Postfork.post_fork at 0x1cf6cc0>
post_worker_init: <function PostWorkerInit.post_worker_init at 0x1cf7430>
worker_int: <function WorkerInt.worker_int at 0x1cf7b80>
worker_abort: <function WorkerAbort.worker_abort at 0x1cf8328>
pre_exec: <function PreExec.pre_exec at 0x1cf73d8>
pre_request: <function PreRequest.pre_request at 0x1cf91e0>
post_request: <function PostRequest.post_request at 0x1cf9920>
child_exit: <function ChildExit.child_exit at 0x1cfa118>
worker_exit: <function WorkerExit.worker_exit at 0x1cfa880>
nworkers_changed: <function NumWorkersChanged.nworkers_changed at 0x1cf9188>
on_exit: <function OnExit.on_exit at 0x1cfb878>
proxy_protocol: False
proxy_allow_ips: ['127.0.0.1']
keyfile: None
certfile: None
ssl_version: 2
cert_reqs: 0
ca_certs: None
suppress_ragged_eofs: True
do_handshake_on_connect: False
ciphers: None
raw_paste_global_conf: []
strip_header_spaces: False
[2021-04-19 22:00:11 +0200] [15979] [INFO] Starting gunicorn 20.1.0
[2021-04-19 22:00:11 +0200] [15979] [DEBUG] Arbiter booted
[2021-04-19 22:00:11 +0200] [15979] [INFO] Listening at: http://192.168.0.80:57831 (15979)
[2021-04-19 22:00:11 +0200] [15979] [INFO] Using worker: sync
[2021-04-19 22:00:11 +0200] [16002] [INFO] Booting worker with pid: 16002
[2021-04-19 22:00:11 +0200] [15979] [DEBUG] 1 workers
[2021-04-19 22:00:14 +0200] [16002] [DEBUG] GET /
[2021-04-19 22:00:14 +0200] [16002] [ERROR] Error handling request /
Traceback (most recent call last):
File "/volume1/homes/admin/.local/lib/python3.8/site-packages/gunicorn/workers/sync.py", line 136, in handle
self.handle_request(listener, req, client, addr)
File "/volume1/homes/admin/.local/lib/python3.8/site-packages/gunicorn/workers/sync.py", line 169, in handle_request
resp, environ = wsgi.create(req, client, addr,
File "/volume1/homes/admin/.local/lib/python3.8/site-packages/gunicorn/http/wsgi.py", line 183, in create
path_info = path_info.split(script_name, 1)[1]
IndexError: list index out of range
[2021-04-19 22:01:11 +0200] [16002] [DEBUG] Closing connection.
[2021-04-19 22:01:11 +0200] [16002] [DEBUG] GET /
[2021-04-19 22:01:11 +0200] [16002] [ERROR] Error handling request /
Traceback (most recent call last):
File "/volume1/homes/admin/.local/lib/python3.8/site-packages/gunicorn/workers/sync.py", line 136, in handle
self.handle_request(listener, req, client, addr)
File "/volume1/homes/admin/.local/lib/python3.8/site-packages/gunicorn/workers/sync.py", line 169, in handle_request
resp, environ = wsgi.create(req, client, addr,
File "/volume1/homes/admin/.local/lib/python3.8/site-packages/gunicorn/http/wsgi.py", line 183, in create
path_info = path_info.split(script_name, 1)[1]
IndexError: list index out of range
任务计划程序命令:
cd /volume1/python/wunschzettel
/volume1/@entware-ng/opt/bin/python3 -m gunicorn -c config.py wsgi:app
注意:我使用完全相同的命令和用户,以及 putty 和调度程序。 请帮我 运行 gunicorn 使用任务调度程序。
我遇到了类似的问题并进行了故障排除。我创建了一个包含两行的起始文件:
export >> "/volume1/web/prod/vars.txt"
/volume1/@appstore/py3k/usr/local/bin/gunicorn -b 0.0.0.0:5010 fl002:app
然后我 运行 通过 SSH 和调度程序。我发现了差异并将其隔离到:
SCRIPT_NAME="/webapi/entry.cgi"
如果我将 Script_name 设置为 ""
,那么问题就不会再出现了。