I have produced a little Python web application using Flask, and that i desired to host it in alwaysdata.internet. I already installed mod_wsgi during my subdomain, however when I attempt to import the primary module of my application it fails since it can not be found. All of the files have been in the /world wide web folder.

Must I place my files elsewhere? I attempted such as the current working directory during my .wsgi file however it still does not work.

For reference, my .wsgi appears like this:

import os

import sys

sys.path.append(os.getcwd())

from ngl import application as application

My application is known as ngl.py and it is within the same folder because the .wsgi file.

Thanks!

The present working directory under mod_wsgi won't be in which the WSGI script is situated, which means you should not be utilising os.getcwd(). See:

http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Application_Working_Directory

To complete what you would like, use:

sys.path.append(os.path.dirname(__file__))

This really is calculating your directory the WSGI script file is within through getting your directory path element of the title from the WSGI script file as recorded in __file__ variable.