Error executing the following code while installing Gunicorn:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
# return 'hello world'
if __name__ == '__main__':
app.run(debug=True)
Use the command: Gunicorn WSGI: application-b 0.0.0.0.0:8000-w 2
Error message:
[2019-01-09 15:39:40 +0800] [29565] [INFO] Starting gunicorn 19.9.0
[2019-01-09 15:39:40 +0800] [29565] [INFO] Listening at: http://0.0.0.0:8000 (29565)
[2019-01-09 15:39:40 +0800] [29565] [INFO] Using worker: sync
[2019-01-09 15:39:40 +0800] [29568] [INFO] Booting worker with pid: 29568
[2019-01-09 15:39:40 +0800] [29570] [INFO] Booting worker with pid: 29570
Failed to find application object 'application' in 'wsgi'
[2019-01-09 15:39:40 +0800] [29568] [INFO] Worker exiting (pid: 29568)
Failed to find application object 'application' in 'wsgi'
[2019-01-09 15:39:40 +0800] [29570] [INFO] Worker exiting (pid: 29570)
Traceback (most recent call last):
File "/home/ejior/.virtualenvs/begin/lib/python3.6/site-packages/gunicorn/arbiter.py", line 203, in run
self.manage_workers()
File "/home/ejior/.virtualenvs/begin/lib/python3.6/site-packages/gunicorn/arbiter.py", line 545, in manage_workers
self.spawn_workers()
File "/home/ejior/.virtualenvs/begin/lib/python3.6/site-packages/gunicorn/arbiter.py", line 617, in spawn_workers
time.sleep(0.1 * random.random())
File "/home/ejior/.virtualenvs/begin/lib/python3.6/site-packages/gunicorn/arbiter.py", line 245, in handle_chld
self.reap_workers()
File "/home/ejior/.virtualenvs/begin/lib/python3.6/site-packages/gunicorn/arbiter.py", line 528, in reap_workers
raise HaltServer(reason, self.APP_LOAD_ERROR)
gunicorn.errors.HaltServer: <HaltServer 'App failed to load.' 4>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ejior/.virtualenvs/begin/bin/gunicorn", line 11, in <module>
sys.exit(run())
File "/home/ejior/.virtualenvs/begin/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 61, in run
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
File "/home/ejior/.virtualenvs/begin/lib/python3.6/site-packages/gunicorn/app/base.py", line 223, in run
super(Application, self).run()
File "/home/ejior/.virtualenvs/begin/lib/python3.6/site-packages/gunicorn/app/base.py", line 72, in run
Arbiter(self).run()
File "/home/ejior/.virtualenvs/begin/lib/python3.6/site-packages/gunicorn/arbiter.py", line 232, in run
self.halt(reason=inst.reason, exit_status=inst.exit_status)
File "/home/ejior/.virtualenvs/begin/lib/python3.6/site-packages/gunicorn/arbiter.py", line 345, in halt
self.stop()
File "/home/ejior/.virtualenvs/begin/lib/python3.6/site-packages/gunicorn/arbiter.py", line 393, in stop
time.sleep(0.1)
File "/home/ejior/.virtualenvs/begin/lib/python3.6/site-packages/gunicorn/arbiter.py", line 245, in handle_chld
self.reap_workers()
File "/home/ejior/.virtualenvs/begin/lib/python3.6/site-packages/gunicorn/arbiter.py", line 528, in reap_workers
raise HaltServer(reason, self.APP_LOAD_ERROR)
gunicorn.errors.HaltServer: <HaltServer 'App failed to load.' 4>
Reason for error:
app = Flask(___)
). This is defined as app
. This should also be used in the command gunicorn-w 4-b 0.0.0.0.0:8000-k gevent wsgi:app
.
Read More:
- Gunicorn reported error worker failed to boot
- Worker failed to boot
- Ngnix+gunicorn+Flag project deployment in Ubuntu
- RuntimeError: NCCL error in: /pytorch/torch/lib/c10d/ProcessGroupNCCL.cpp:784 torch
- [error reported] [Python] [Matplotlib] importerror: failed to import any QT binding
- [resolved] superset failed to create admin user: error! User already exists user or attributeerror: ‘nonetype’‘
- ModuleNotFoundError: No module named ‘numpy.testing.nosetester‘
- How to Solve failed Precondition Error: attempting to use uninitialized value beta1_power
- Scrapy runs a crawler with an error importerror: cannot import name suppress
- Resolve – keyerror encountered while installing tensorflow GPU: ‘tensorflow’ error
- ubuntu install mysqlclient error ERROR: Failed building wheel for mysqlclient solution
- (29)RuntimeError: cuda runtime error (999)
- Error encountered while executing PIP install: error: complete output from command Python setup.py egg_ info:
- tensorflow import error: DLL load failed: The specified module could not be found (DLL load failed: The specified module could not be found)
- Tensorflow import error: DLL load failed: the specified module could not be found
- chatbot error: [E941] Can‘t find model ‘en‘
- An error occurred when starting pyspider with Python 3.7
- The problem of “value error: zero length field name in format” in Python 2.6.6 of CentOS 6.9
- Installing flash in MAC environment
- django.core.exceptions . improveconfigured: error loading MySQL DB module. Django configuring MySQL database