Deployment of my flask app getting failed with ModuleNotFoundError: No module named 'app'

project GitHub link https://github.com/divyanshbhatt527/flask_blog

Nov 29 01:03:06 AM ==> Starting service with ‘gunicorn app:app’
Nov 29 01:03:08 AM Traceback (most recent call last):
Nov 29 01:03:08 AM File “/opt/render/project/src/.venv/bin/gunicorn”, line 8, in
Nov 29 01:03:08 AM sys.exit(run())
Nov 29 01:03:08 AM File “/opt/render/project/src/.venv/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py”, line 67, in run
Nov 29 01:03:08 AM WSGIApplication(“%(prog)s [OPTIONS] [APP_MODULE]”).run()
Nov 29 01:03:08 AM File “/opt/render/project/src/.venv/lib/python3.7/site-packages/gunicorn/app/base.py”, line 231, in run
Nov 29 01:03:08 AM super().run()
Nov 29 01:03:08 AM File “/opt/render/project/src/.venv/lib/python3.7/site-packages/gunicorn/app/base.py”, line 72, in run
Nov 29 01:03:08 AM Arbiter(self).run()
Nov 29 01:03:08 AM File “/opt/render/project/src/.venv/lib/python3.7/site-packages/gunicorn/arbiter.py”, line 58, in init
Nov 29 01:03:08 AM self.setup(app)
Nov 29 01:03:08 AM File “/opt/render/project/src/.venv/lib/python3.7/site-packages/gunicorn/arbiter.py”, line 118, in setup
Nov 29 01:03:08 AM self.app.wsgi()
Nov 29 01:03:08 AM File “/opt/render/project/src/.venv/lib/python3.7/site-packages/gunicorn/app/base.py”, line 67, in wsgi
Nov 29 01:03:08 AM self.callable = self.load()
Nov 29 01:03:08 AM File “/opt/render/project/src/.venv/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py”, line 58, in load
Nov 29 01:03:08 AM return self.load_wsgiapp()
Nov 29 01:03:08 AM File “/opt/render/project/src/.venv/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py”, line 48, in load_wsgiapp
Nov 29 01:03:08 AM return util.import_app(self.app_uri)
Nov 29 01:03:08 AM File “/opt/render/project/src/.venv/lib/python3.7/site-packages/gunicorn/util.py”, line 359, in import_app
Nov 29 01:03:08 AM mod = importlib.import_module(module)
Nov 29 01:03:08 AM File “/usr/local/lib/python3.7/importlib/init.py”, line 127, in import_module
Nov 29 01:03:08 AM return _bootstrap._gcd_import(name[level:], package, level)
Nov 29 01:03:08 AM File “”, line 1006, in _gcd_import
Nov 29 01:03:08 AM File “”, line 983, in _find_and_load
Nov 29 01:03:08 AM File “”, line 965, in _find_and_load_unlocked
Nov 29 01:03:08 AM ModuleNotFoundError: No module named ‘app’

This issue is resolved now. I’ve not updated the gunicorn app name in my settings on Render. Instead of “web: gunicorn app:app” we’ve to use “web: gunicorn ‘Your_app_name’:app”. Which in my case was “web: gunicorn run:app”

Hi there,

Glad to hear you were able to resolve your issue and thanks for sharing the solution with the community.

Thanks for using Render!

Alan

1 Like

I have the same issue and it didn’t help me

1 Like

Oh! I’m so sorry. I made a mistake there. Instead of ‘Your_application_name’, it will be the name of your application file which is used to execute your application for the first time. In my case it was run.py

In my run.py file, I had the start command for executing for the first time.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.