Flask deploy on Windows using Apache 24 and WSGI gives ModuleNotFoundError

  apache, python, windows, wsgi

I’m trying to deploy a Flask server on Windows machine (Company policy).
It’s simple project following file structure:

  • app.py /* Main flask app*/
  • db /* folder for dbConnector file */
    • dbConnector.py
  • static
  • templates
  • myenv
  • wsgi_scripts
    • gamonweb.wsgi

It works fine when I run it as Flask server.
When I try to deploy it, it returns:

File "C:GamonWebgamonwebapp.py", line 5, in <module>r

from db import dbConnector as dbConnectorr

 ModuleNotFoundError: No module named 'db'r

The import part from app.py is: from db import dbConnector as dbConnector

I had this issue with flask module but that I was able to resolve with pip install flask. As this is my own file, how can I modify it to make it work?
Thank you!

Source: Windows Questions

LEAVE A COMMENT