installing my first WSGI
Question: I am installing a flask app with apache modewsgi.

I have solved multiple troubles already: \- environment variables \-
virtualenv \- file permissions

But now I am really stuck with application name. I have no idea what to write
in the "from" directive of WSGI file.

here is my ~user/appname.com/appname.com.wsgi

    
    
    activate_this = '/home/user/appname.com/venv/bin/activate_this.py'
    execfile(activate_this, dict(__file__=activate_this))
    import sys
    sys.path.insert(0, '/home/user/appname.com')
    from appname.com import app as application
    

which causes the following log.

    
    
    [Mon Apr 08 15:50:26 2013] [error] [client 64.120.6.170] mod_wsgi (pid=6392): Exception occurred processing WSGI script '/home/user/appname.com/appname.com.wsgi'.
    [Mon Apr 08 15:50:26 2013] [error] [client 64.120.6.170] Traceback (most recent call last):
    [Mon Apr 08 15:50:26 2013] [error] [client 64.120.6.170]   File "/home/user/appname.com/appname.com.wsgi", line 5, in <module>
    [Mon Apr 08 15:50:26 2013] [error] [client 64.120.6.170]     from appname.com import app as application
    [Mon Apr 08 15:50:26 2013] [error] [client 64.120.6.170] ImportError: No module named appname.com
    

However if I remove the the from `appname.com` I can run the .wsgi from python
commandline without error but within apache, it throws the error below...

    
    
    [Mon Apr 08 15:27:31 2013] [error] [client 64.120.6.170] mod_wsgi (pid=6274): Exception occurred processing WSGI script '/home/user/appname.com/appname.com.wsgi'.
    [Mon Apr 08 15:27:31 2013] [error] [client 64.120.6.170] TypeError: 'module' object is not callable
    

_UPDATE:_

Here is a structure of ~user/appname.com/

    
    
    app/
        controller.py
        __init__.py
        models.py
        ...
        static/
            ...
        templates/
    config.py
    Procfile
    README
    requirements.txt
    run.py
    appname.com.wsgi
    


Answer: Because of how you have structured your directories, you would need to add:

  * /home/user

to sys.path.

To explain what the second error is, would need to see what is in 'com.py'.

I would suggest though that it is a very bad idea to name your directory
'appname.com'. The presence of the '.' in the directory name will confuse
Python.

