Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

416
Vistas
WSGI file not loading Python Flask file on Apache 2.4 on Windows Server 2012

I'm trying to run a Flask script that queries an SQLite database and displays a Rest API only for inside the network. It is going to be served on Windows Server 2012 running Apache 2.4 with mod_wsgi. I'm also using Python 3.7.

The error I'm getting in the error log is:

File "D:/sites/cifsearch/website/web.wsgi", line 7, in <module>\r, referer: 
     http://IP Address/  from app.py import app as application\r, referer: 
     http://IP Address/  ModuleNotFoundError: No module named 'app'\r, referer: http://IP Address/

web.wsgi is on the same directory as app.py

This is what I have written on web.wsgi. I copied and pasted this from what I could find on google as I'm still very new to this.

import sys
import logging

logging.basicConfig (stream=sys.stderr)
sys.path.insert(0,'/')

from app.py import app as application

I also commented out:

if __name__ == "__main__":
     app.run()

in app.py as per this site: https://flask.palletsprojects.com/en/1.1.x/deploying/mod_wsgi/. But I don't think the request is even getting that far. I'm suspecting, it's probably path related or permissions?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Your application is not set up as a package, so the import in your wsgi code gives you the ModuleNotFoundError.

Put your application in a directory called e.g. myapp and add an __init__.py file to the directory containing

from .app import app

to make it a package.

Your directory structure should look like this:

web.wsgi
myapp/
    app.py
    __init__.py

Then change your import line in the wsgi file to

from myapp import app as application
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda