简体   繁体   中英

heroku gunicorn / Flask App Running Error

I'm trying to push my first flask app to heroku but I couldn't figure out what the problem is. I have tried many times to find the problem by following the errors but I felt I was spinning.This app is working in local but not on heroku

I tried many different methods and I have manually corrected the requirements.txt versions to eliminate the version problems but I cannot figure out what is the current problem.

Here is the heroku logs --tail output:

$ heroku logs --tail
2021-03-27T17:31:01.216069+00:00 app[web.1]: return self.load_wsgiapp()
2021-03-27T17:31:01.216070+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2021-03-27T17:31:01.216070+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-03-27T17:31:01.216070+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2021-03-27T17:31:01.216071+00:00 app[web.1]: mod = importlib.import_module(module)
2021-03-27T17:31:01.216071+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2021-03-27T17:31:01.216072+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-03-27T17:31:01.216072+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2021-03-27T17:31:01.216073+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2021-03-27T17:31:01.216073+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
2021-03-27T17:31:01.216080+00:00 app[web.1]: ModuleNotFoundError: No module named 'app'
2021-03-27T17:31:01.216311+00:00 app[web.1]: [2021-03-27 17:31:01 +0000] [9] [INFO] Worker exiting (pid: 9)
2021-03-27T17:31:01.257899+00:00 app[web.1]: [2021-03-27 17:31:01 +0000] [10] [INFO] Booting worker with pid: 10
2021-03-27T17:31:01.271113+00:00 app[web.1]: [2021-03-27 17:31:01 +0000] [10] [ERROR] Exception in worker process
2021-03-27T17:31:01.271116+00:00 app[web.1]: Traceback (most recent call last):
2021-03-27T17:31:01.271116+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2021-03-27T17:31:01.271117+00:00 app[web.1]: worker.init_process()
2021-03-27T17:31:01.271117+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2021-03-27T17:31:01.271118+00:00 app[web.1]: self.load_wsgi()
2021-03-27T17:31:01.271118+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2021-03-27T17:31:01.271119+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-03-27T17:31:01.271119+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-03-27T17:31:01.271120+00:00 app[web.1]: self.callable = self.load()
2021-03-27T17:31:01.271120+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2021-03-27T17:31:01.271120+00:00 app[web.1]: return self.load_wsgiapp()
2021-03-27T17:31:01.271121+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2021-03-27T17:31:01.271121+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-03-27T17:31:01.271122+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2021-03-27T17:31:01.271122+00:00 app[web.1]: mod = importlib.import_module(module)
2021-03-27T17:31:01.271123+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2021-03-27T17:31:01.271123+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-03-27T17:31:01.271123+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2021-03-27T17:31:01.271124+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2021-03-27T17:31:01.271124+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
2021-03-27T17:31:01.271199+00:00 app[web.1]: ModuleNotFoundError: No module named 'app'
2021-03-27T17:31:01.271576+00:00 app[web.1]: [2021-03-27 17:31:01 +0000] [10] [INFO] Worker exiting (pid: 10)
2021-03-27T17:31:01.395630+00:00 app[web.1]: [2021-03-27 17:31:01 +0000] [4] [INFO] Shutting down: Master
2021-03-27T17:31:01.395757+00:00 app[web.1]: [2021-03-27 17:31:01 +0000] [4] [INFO] Reason: Worker failed to boot.
2021-03-27T17:31:01.525831+00:00 heroku[web.1]: Process exited with status 3
2021-03-27T17:31:01.610510+00:00 heroku[web.1]: State changed from starting to crashed
2021-03-27T17:31:01.614922+00:00 heroku[web.1]: State changed from crashed to starting
2021-03-27T17:31:03.000000+00:00 app[api]: Build succeeded
2021-03-27T17:31:09.148954+00:00 heroku[web.1]: Starting process with command `gunicorn app:app`
2021-03-27T17:31:11.566273+00:00 app[web.1]: [2021-03-27 17:31:11 +0000] [4] [INFO] Starting gunicorn 20.0.4
2021-03-27T17:31:11.566853+00:00 app[web.1]: [2021-03-27 17:31:11 +0000] [4] [INFO] Listening at: http://0.0.0.0:56319 (4)
2021-03-27T17:31:11.566948+00:00 app[web.1]: [2021-03-27 17:31:11 +0000] [4] [INFO] Using worker: sync
2021-03-27T17:31:11.571477+00:00 app[web.1]: [2021-03-27 17:31:11 +0000] [9] [INFO] Booting worker with pid: 9
2021-03-27T17:31:11.577573+00:00 app[web.1]: [2021-03-27 17:31:11 +0000] [9] [ERROR] Exception in worker process
2021-03-27T17:31:11.577574+00:00 app[web.1]: Traceback (most recent call last):
2021-03-27T17:31:11.577575+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2021-03-27T17:31:11.577576+00:00 app[web.1]: worker.init_process()
2021-03-27T17:31:11.577576+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2021-03-27T17:31:11.577576+00:00 app[web.1]: self.load_wsgi()
2021-03-27T17:31:11.577577+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2021-03-27T17:31:11.577578+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-03-27T17:31:11.577578+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-03-27T17:31:11.577579+00:00 app[web.1]: self.callable = self.load()
2021-03-27T17:31:11.577579+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2021-03-27T17:31:11.577580+00:00 app[web.1]: return self.load_wsgiapp()
2021-03-27T17:31:11.577580+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2021-03-27T17:31:11.577581+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-03-27T17:31:11.577581+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2021-03-27T17:31:11.577582+00:00 app[web.1]: mod = importlib.import_module(module)
2021-03-27T17:31:11.577582+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2021-03-27T17:31:11.577583+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-03-27T17:31:11.577583+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2021-03-27T17:31:11.577583+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2021-03-27T17:31:11.577584+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
2021-03-27T17:31:11.577589+00:00 app[web.1]: ModuleNotFoundError: No module named 'app'
2021-03-27T17:31:11.577776+00:00 app[web.1]: [2021-03-27 17:31:11 +0000] [9] [INFO] Worker exiting (pid: 9)
2021-03-27T17:31:11.580125+00:00 app[web.1]: [2021-03-27 17:31:11 +0000] [10] [INFO] Booting worker with pid: 10
2021-03-27T17:31:11.587148+00:00 app[web.1]: [2021-03-27 17:31:11 +0000] [10] [ERROR] Exception in worker process
2021-03-27T17:31:11.587149+00:00 app[web.1]: Traceback (most recent call last):
2021-03-27T17:31:11.587150+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2021-03-27T17:31:11.587151+00:00 app[web.1]: worker.init_process()
2021-03-27T17:31:11.587151+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2021-03-27T17:31:11.587152+00:00 app[web.1]: self.load_wsgi()
2021-03-27T17:31:11.587152+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2021-03-27T17:31:11.587152+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-03-27T17:31:11.587153+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-03-27T17:31:11.587154+00:00 app[web.1]: self.callable = self.load()
2021-03-27T17:31:11.587154+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2021-03-27T17:31:11.587154+00:00 app[web.1]: return self.load_wsgiapp()
2021-03-27T17:31:11.587155+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2021-03-27T17:31:11.587155+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-03-27T17:31:11.587155+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2021-03-27T17:31:11.587156+00:00 app[web.1]: mod = importlib.import_module(module)
2021-03-27T17:31:11.587156+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2021-03-27T17:31:11.587156+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-03-27T17:31:11.587157+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2021-03-27T17:31:11.587160+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2021-03-27T17:31:11.587161+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
2021-03-27T17:31:11.587165+00:00 app[web.1]: ModuleNotFoundError: No module named 'app'
2021-03-27T17:31:11.587315+00:00 app[web.1]: [2021-03-27 17:31:11 +0000] [10] [INFO] Worker exiting (pid: 10)
2021-03-27T17:31:11.720435+00:00 app[web.1]: [2021-03-27 17:31:11 +0000] [4] [INFO] Shutting down: Master
2021-03-27T17:31:11.720548+00:00 app[web.1]: [2021-03-27 17:31:11 +0000] [4] [INFO] Reason: Worker failed to boot.
2021-03-27T17:31:11.788282+00:00 heroku[web.1]: Process exited with status 3
2021-03-27T17:31:11.923225+00:00 heroku[web.1]: State changed from starting to crashed

and the procfile is:

web: gunicorn app:app
heroku ps:scale web=1

Project file structure is seen as:

E:.
├───flaskblog
│   ├───errors
│   │   └───__pycache__
│   ├───main
│   │   └───__pycache__
│   ├───posts
│   │   └───__pycache__
│   ├───static
│   │   └───profile_pics
│   ├───templates
│   │   ├───.vscode
│   │   └───errors
│   ├───users
│   │   └───__pycache__
│   ├───venv
│   │   ├───Include
│   │   ├───Lib
│   │   │   └───site-packages
│   │   │       ├───certifi
│   │   │       │   └───__pycache__
│   │   │       ├───certifi-2020.12.5.dist-info
│   │   │       ├───chardet
│   │   │       │   ├───cli
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───metadata
│   │   │       │   │   └───__pycache__
│   │   │       │   └───__pycache__
│   │   │       ├───chardet-4.0.0.dist-info
│   │   │       ├───click
│   │   │       │   └───__pycache__
│   │   │       ├───click-7.1.2.dist-info
│   │   │       ├───dns
│   │   │       │   ├───rdtypes
│   │   │       │   │   ├───ANY
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───CH
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───IN
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   └───__pycache__
│   │   │       │   └───__pycache__
│   │   │       ├───dnspython-2.1.0.dist-info
│   │   │       ├───email_validator
│   │   │       │   └───__pycache__
│   │   │       ├───email_validator-1.1.2.dist-info
│   │   │       ├───flask
│   │   │       │   ├───json
│   │   │       │   │   └───__pycache__
│   │   │       │   └───__pycache__
│   │   │       ├───Flask-1.1.2.dist-info
│   │   │       ├───flask_sqlalchemy
│   │   │       │   └───__pycache__
│   │   │       ├───Flask_SQLAlchemy-2.4.4.dist-info
│   │   │       ├───flask_wtf
│   │   │       │   ├───recaptcha
│   │   │       │   │   └───__pycache__
│   │   │       │   └───__pycache__
│   │   │       ├───Flask_WTF-0.14.3.dist-info
│   │   │       ├───idna
│   │   │       │   └───__pycache__
│   │   │       ├───idna-2.10.dist-info
│   │   │       ├───itsdangerous
│   │   │       │   └───__pycache__
│   │   │       ├───itsdangerous-1.1.0.dist-info
│   │   │       ├───jinja2
│   │   │       │   └───__pycache__
│   │   │       ├───Jinja2-2.11.3.dist-info
│   │   │       ├───markupsafe
│   │   │       │   └───__pycache__
│   │   │       ├───MarkupSafe-1.1.1.dist-info
│   │   │       ├───pip
│   │   │       │   ├───_internal
│   │   │       │   │   ├───cli
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───commands
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───distributions
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───index
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───models
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───network
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───operations
│   │   │       │   │   │   ├───build
│   │   │       │   │   │   │   └───__pycache__
│   │   │       │   │   │   ├───install
│   │   │       │   │   │   │   └───__pycache__
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───req
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───resolution
│   │   │       │   │   │   ├───legacy
│   │   │       │   │   │   │   └───__pycache__
│   │   │       │   │   │   ├───resolvelib
│   │   │       │   │   │   │   └───__pycache__
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───utils
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───vcs
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───_vendor
│   │   │       │   │   ├───cachecontrol
│   │   │       │   │   │   ├───caches
│   │   │       │   │   │   │   └───__pycache__
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───certifi
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───chardet
│   │   │       │   │   │   ├───cli
│   │   │       │   │   │   │   └───__pycache__
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───colorama
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───distlib
│   │   │       │   │   │   ├───_backport
│   │   │       │   │   │   │   └───__pycache__
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───html5lib
│   │   │       │   │   │   ├───filters
│   │   │       │   │   │   │   └───__pycache__
│   │   │       │   │   │   ├───treeadapters
│   │   │       │   │   │   │   └───__pycache__
│   │   │       │   │   │   ├───treebuilders
│   │   │       │   │   │   │   └───__pycache__
│   │   │       │   │   │   ├───treewalkers
│   │   │       │   │   │   │   └───__pycache__
│   │   │       │   │   │   ├───_trie
│   │   │       │   │   │   │   └───__pycache__
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───idna
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───msgpack
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───packaging
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───pep517
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───pkg_resources
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───progress
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───requests
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───resolvelib
│   │   │       │   │   │   ├───compat
│   │   │       │   │   │   │   └───__pycache__
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───toml
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───urllib3
│   │   │       │   │   │   ├───contrib
│   │   │       │   │   │   │   ├───_securetransport
│   │   │       │   │   │   │   │   └───__pycache__
│   │   │       │   │   │   │   └───__pycache__
│   │   │       │   │   │   ├───packages
│   │   │       │   │   │   │   ├───backports
│   │   │       │   │   │   │   │   └───__pycache__
│   │   │       │   │   │   │   ├───ssl_match_hostname
│   │   │       │   │   │   │   │   └───__pycache__
│   │   │       │   │   │   │   └───__pycache__
│   │   │       │   │   │   ├───util
│   │   │       │   │   │   │   └───__pycache__
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───webencodings
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   └───__pycache__
│   │   │       │   └───__pycache__
│   │   │       ├───pip-20.2.3.dist-info
│   │   │       ├───pkg_resources
│   │   │       │   ├───extern
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───_vendor
│   │   │       │   │   ├───packaging
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   └───__pycache__
│   │   │       │   └───__pycache__
│   │   │       ├───pytz
│   │   │       │   ├───zoneinfo
│   │   │       │   │   ├───Africa
│   │   │       │   │   ├───America
│   │   │       │   │   │   ├───Argentina
│   │   │       │   │   │   ├───Indiana
│   │   │       │   │   │   ├───Kentucky
│   │   │       │   │   │   └───North_Dakota
│   │   │       │   │   ├───Antarctica
│   │   │       │   │   ├───Arctic
│   │   │       │   │   ├───Asia
│   │   │       │   │   ├───Atlantic
│   │   │       │   │   ├───Australia
│   │   │       │   │   ├───Brazil
│   │   │       │   │   ├───Canada
│   │   │       │   │   ├───Chile
│   │   │       │   │   ├───Etc
│   │   │       │   │   ├───Europe
│   │   │       │   │   ├───Indian
│   │   │       │   │   ├───Mexico
│   │   │       │   │   ├───Pacific
│   │   │       │   │   └───US
│   │   │       │   └───__pycache__
│   │   │       ├───pytz-2021.1.dist-info
│   │   │       ├───requests
│   │   │       │   └───__pycache__
│   │   │       ├───requests-2.25.1.dist-info
│   │   │       ├───setuptools
│   │   │       │   ├───command
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───extern
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───_distutils
│   │   │       │   │   ├───command
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───_vendor
│   │   │       │   │   ├───packaging
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   └───__pycache__
│   │   │       │   └───__pycache__
│   │   │       ├───setuptools-49.2.1.dist-info
│   │   │       ├───sqlalchemy
│   │   │       │   ├───connectors
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───databases
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───dialects
│   │   │       │   │   ├───firebird
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───mssql
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───mysql
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───oracle
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───postgresql
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───sqlite
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───sybase
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───engine
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───event
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───ext
│   │   │       │   │   ├───declarative
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───orm
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───pool
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───sql
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───testing
│   │   │       │   │   ├───plugin
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───suite
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───util
│   │   │       │   │   └───__pycache__
│   │   │       │   └───__pycache__
│   │   │       ├───SQLAlchemy-1.3.23.dist-info
│   │   │       ├───urllib3
│   │   │       │   ├───contrib
│   │   │       │   │   ├───_securetransport
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───packages
│   │   │       │   │   ├───backports
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───ssl_match_hostname
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───util
│   │   │       │   │   └───__pycache__
│   │   │       │   └───__pycache__
│   │   │       ├───urllib3-1.26.3.dist-info
│   │   │       ├───werkzeug
│   │   │       │   ├───debug
│   │   │       │   │   ├───shared
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───middleware
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───wrappers
│   │   │       │   │   └───__pycache__
│   │   │       │   └───__pycache__
│   │   │       ├───Werkzeug-1.0.1.dist-info
│   │   │       ├───wtforms
│   │   │       │   ├───csrf
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───ext
│   │   │       │   │   ├───appengine
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───csrf
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───dateutil
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───django
│   │   │       │   │   │   ├───templatetags
│   │   │       │   │   │   │   └───__pycache__
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───i18n
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   ├───sqlalchemy
│   │   │       │   │   │   └───__pycache__
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───fields
│   │   │       │   │   └───__pycache__
│   │   │       │   ├───locale
│   │   │       │   │   ├───ar
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───bg
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───ca
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───cs_CZ
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───cy
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───de
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───de_CH
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───el
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───en
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───es
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───et
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───fa
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───fi
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───fr
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───he
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───hu
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───it
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───ja
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───ko
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───nb
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───nl
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───pl
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───pt
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───ru
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───sk
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───sv
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───tr
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───uk
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   ├───zh
│   │   │       │   │   │   └───LC_MESSAGES
│   │   │       │   │   └───zh_TW
│   │   │       │   │       └───LC_MESSAGES
│   │   │       │   ├───widgets
│   │   │       │   │   └───__pycache__
│   │   │       │   └───__pycache__
│   │   │       ├───WTForms-2.3.3.dist-info
│   │   │       └───__pycache__
│   │   └───Scripts
│   └───__pycache__
└───__pycache__

Thanks for your help in advance!

PS: after long hours of searching and many tweaking of settings the solution was the change the name app.py to main.py then change procfile web: gunicorn main:app

I hope this help to who face the same problem with me.

This is the error you should look at: 2021-03-27T17:31:11.587165+00:00 app[web.1]: ModuleNotFoundError: No module named 'app'

Probable reasons for this error:

  1. Procfile not well declared
# This is how it should be:

web: flask db upgrade; gunicorn tinker:app

The Procfile begins with a process name (in this case, it is a web application, so we will use web ). After the colon, you will need to define the commands you need. Finally, you need to declare your server.

  1. Similar names used for your application entry file and the app sub-folder. This is what I mean:
project_folder
     | ----------app.py # entry file
     | ----------config.py
     | ----------app/
                   | ---------- __init__.py
                   | ---------- routes.py
                   | ---------- templates/
                   | ---------- static/

As seen in this structure, your application entry file is called app.py . If you are using a different structure, this file is where you run your code. Note that this name is the same as the app subfolder.

So, when you are declaring your web app in Procfile , what you should do is to first rename the entry file name in your application structure to something else such as my_entry_file.py . Then add it to the Procfile :

web: flask db upgrade; gunicorn my_entry_file:app

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM