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)
Well the error message clearly says that you don't have Flask installed. If you created application in webfaction control panel as for Python 2.7 then you also need to install all the libs and Flask itself for Python 2.7. You saying that you installed everything with easy_instal2.6, so it means you installed everything for Python 2.6.
I would say firstly install all the libs and deps (flask too) for Python 2.7 and try again. Also I would suggest to start using virtualenv, cause it will help do not mess with the packages versions later (some short info on how deploy with virtualenv on webfaction http://manavgoel.net/blog/post/2012/7/Deploying-flask-website-on-webfaction).