Flask
From DreamHost
Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions. And before you ask: It's BSD licensed! Flask runs on Dreamhost via Passenger WSGI.
Quickstart
- Set up an environment using virtualenv
- virtualenv-1.5.2/virtualenv.py --no-site-packages --distribute $HOME/flask_env
- Activate it and install Flask
- cd flask_env
- source bin/activate
- easy_install pip
- pip install Flask
- Use the Dreamhost Control Panel to create a Passenger WSGI domain inside of your virtualenv
- Web directory: /home/username/flask_env/public
- Passenger (Ruby/Python apps only): Yes!
- Put your Flask site inside of the virtualenv, but not inside of the public dir
- cd $HOME/flask_env
- mkdir mysite
- Put a passenger_wsgi.py file inside of the virtualenv.
Example passenger_wsgi.py
import sys, os
INTERP = os.path.join(os.environ['HOME'], 'flask_env', 'bin', 'python')
if sys.executable != INTERP:
os.execl(INTERP, INTERP, *sys.argv)
sys.path.append(os.getcwd())
from mysite import app as application
# Uncomment next two lines to enable debugging
# from werkzeug.debug import DebuggedApplication
# application = DebuggedApplication(application, evalex=True)
Refresh After Changes
To force a refresh of your site after making changes, touch restart.txt:
- cd $HOME/flask_env
- mkdir tmp
- touch tmp/restart.txt