I been following instructions here: http://flask.pocoo.org/snippets/65/
But some things aren't very clearly written.
So my structure is like this:
/<username>/webapps/flask/
----__init__.py
/<username>/webapps/flask/htdocs/
----index.py
----config.py
----/app/ (this is my flask application where i have views.py).
----/tmp/
My __init__.py:
class WebFactionMiddleware(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
environ['SCRIPT_NAME'] = '/app'
return self.app(environ, start_response)
app.wsgi_app = WebFactionMiddleware(app.wsgi_app)
My index.py:
from flask import app as application
My httpd.conf:
WSGIPythonPath /home/<username>/webapps/flask/htdocs/
#If you do not specify the following directive the app *will* work but you will
#see index.py in the path of all URLs
WSGIScriptAlias /app /home/<username>/webapps/flask/htdocs/index.py
<Directory /home/<username>/webapps/flask/htdocs>
AddHandler wsgi-script .py
RewriteEngine on
RewriteBase /app
WSGIScriptReloading On
</Directory>
I installed from Control panel as "wsgi 3.4/Python2.7", but I had to install in SSH SQLAlchemy, flask-login, etc. using easy-install2.6 because easy-install2.7 doesn't exist.
Server error logs says:
from flask import app as application
[Sun Nov 04 23:29:12 2012] [error] [client 127.0.0.1] ImportError: No module named flask
(I did restart apache2)