python - Gunicorn 工人无法启动
问题描述
我正在使用 Flask 创建一个小应用程序,我想在线部署网站。当我尝试开始时,我现在面临着 gunicorn 的问题。我将 gunicorn 与 nginx 一起使用。Nginx 没有问题,我可以在线访问我所有的静态文件,但要启动网站,我需要运行 gunicorn。
使用以下命令启动 gunicorn :
gunicorn -w 3 myapp:app
我得到这个不断循环的错误
[2020-08-05 15:13:14 +0000] [2033] [INFO] Starting gunicorn 20.0.4
[2020-08-05 15:13:14 +0000] [2033] [INFO] Listening at: http://127.0.0.1:8000 (2033)
[2020-08-05 15:13:14 +0000] [2033] [INFO] Using worker: sync
[2020-08-05 15:13:14 +0000] [2035] [INFO] Booting worker with pid: 2035
[2020-08-05 15:13:14 +0000] [2036] [INFO] Booting worker with pid: 2036
[2020-08-05 15:13:14 +0000] [2037] [INFO] Booting worker with pid: 2037
Usage: gunicorn [OPTIONS]
Try 'gunicorn --help' for help.
Error: no such option: -w
[2020-08-05 15:13:14 +0000] [2035] [INFO] Worker exiting (pid: 2035)
Usage: gunicorn [OPTIONS]
Try 'gunicorn --help' for help.
在这里,您可以使用选项 --log-level debug 查看命令的结果:
[2020-08-06 06:02:29 +0000] [3943] [DEBUG] Current configuration:
config: None
bind: ['127.0.0.1:8000']
backlog: 2048
workers: 3
worker_class: sync
threads: 1
worker_connections: 1000
max_requests: 0
max_requests_jitter: 0
timeout: 30
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
preload_app: False
sendfile: None
reuse_port: False
chdir: /home/ubuntu/MyWebsite/server
daemon: False
raw_env: []
pidfile: None
worker_tmp_dir: None
user: 1000
group: 1000
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: app:app
pythonpath: None
paste: None
on_starting: <function OnStarting.on_starting at 0x7f5c482e2160>
on_reload: <function OnReload.on_reload at 0x7f5c482e2280>
when_ready: <function WhenReady.when_ready at 0x7f5c482e23a0>
pre_fork: <function Prefork.pre_fork at 0x7f5c482e24c0>
post_fork: <function Postfork.post_fork at 0x7f5c482e25e0>
post_worker_init: <function PostWorkerInit.post_worker_init at 0x7f5c482e2700>
worker_int: <function WorkerInt.worker_int at 0x7f5c482e2820>
worker_abort: <function WorkerAbort.worker_abort at 0x7f5c482e2940>
pre_exec: <function PreExec.pre_exec at 0x7f5c482e2a60>
pre_request: <function PreRequest.pre_request at 0x7f5c482e2b80>
post_request: <function PostRequest.post_request at 0x7f5c482e2c10>
child_exit: <function ChildExit.child_exit at 0x7f5c482e2d30>
worker_exit: <function WorkerExit.worker_exit at 0x7f5c482e2e50>
nworkers_changed: <function NumWorkersChanged.nworkers_changed at 0x7f5c482e2f70>
on_exit: <function OnExit.on_exit at 0x7f5c482ef0d0>
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
[2020-08-06 06:02:29 +0000] [3943] [INFO] Starting gunicorn 20.0.4
[2020-08-06 06:02:29 +0000] [3943] [DEBUG] Arbiter booted
[2020-08-06 06:02:29 +0000] [3943] [INFO] Listening at: http://127.0.0.1:8000 (3943)
[2020-08-06 06:02:29 +0000] [3943] [INFO] Using worker: sync
[2020-08-06 06:02:29 +0000] [3945] [INFO] Booting worker with pid: 3945
[2020-08-06 06:02:29 +0000] [3946] [INFO] Booting worker with pid: 3946
[2020-08-06 06:02:29 +0000] [3947] [INFO] Booting worker with pid: 3947
[2020-08-06 06:02:29 +0000] [3943] [DEBUG] 3 workers
Usage: gunicorn [OPTIONS]
Try "gunicorn --help" for help.
Error: no such option: -w
[2020-08-06 06:02:29 +0000] [3945] [INFO] Worker exiting (pid: 3945)
Usage: gunicorn [OPTIONS]
Try "gunicorn --help" for help.
Error: no such option: -w
[2020-08-06 06:02:30 +0000] [3946] [INFO] Worker exiting (pid: 3946)
[2020-08-06 06:02:30 +0000] [3948] [INFO] Booting worker with pid: 3948
有人知道如何解决这个问题或知道问题出在哪里吗?
谢谢
解决方案
推荐阅读
- isabelle - 是否可以在 Isar 中编写非自动形式化?
- python - 是否可以在 python 中使用 opencv 将图像中的亮度调整为最暗?
- python - 当存储的值经常更改时,使用元组并根据需要用更新的元组替换它们或者使用可变列表是否更快?
- r - 如何躲避重叠的线段以保持它们平行
- reactjs - 未捕获的类型错误:“utils.useControlled”不是函数
- firebase - 如何从 Flutter 应用程序中删除 firebase 用户?
- c# - WPF 使用 INotifyPropertyChanged 更新列表视图
- node.js - Parse Server:用户信息不能在云代码上更改
- java - android保存文件/创建文件夹到sd卡
- c# - C# 安全风险