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
- An error occurred when running ROCR: Failed to load the package ‘caTools’, package or namespace load failed
- The MySQL load data command parses and handles error 29 (errCode: 13) errors (in the Ubuntu environment)
- tensorflow import error: DLL load failed: The specified module could not be found (DLL load failed: The specified module could not be found)
- tensorflow.python.framework.errors_impl.InternalError: Failed to create session.
- Error failed to compile with 1 errors
- [Solved] ERROR Failed to compile with 3 errors These dependencies were not found: * pdfjs-dist/es5/buil
- Failed to load platform rendering library
- Failed to load image from file “* * *. Png“
- Failed to load resource: net::ERR_CONNECTION_REFUSED
- R | failed to load cairo DLL
- Mybatis reverse problem failed to load ApplicationContext
- Failed to load the native TensorFlow runtime.
- Failed to load resource: the server responded with a status of 503 (Service Unavailable)
- Form Compile Issues: (FRM-18108: Failed to load the following objects)
- Error running Eclipse: failed to load the JNI shared library
- Solve the Google Chrome Failed to load resource: net::ERR_FAILED problem
- Failed to load the JNI shared library solution