Skip to content

Instantly share code, notes, and snippets.

@geoffalday
Created March 6, 2012 13:19
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geoffalday/1986240 to your computer and use it in GitHub Desktop.
Save geoffalday/1986240 to your computer and use it in GitHub Desktop.
Getting a Python/Flask app running on Webfaction
# Follow instructions here: http://flask.pocoo.org/snippets/65/
# You'll need to make sure you have the right Python version and any packages installed: http://docs.webfaction.com/software/python.html
# This tweak to index.py is what made it actually work: http://stackoverflow.com/questions/3696606/how-to-solve-import-errors-while-trying-to-deploy-flask-using-wsgi-on-apache2
import sys
yourappname = "/home/username/webapps/yourappname/htdocs"
if not yourappname in sys.path:
sys.path.insert(0, yourappname)
from yourappname import app as application
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run()
@briandailey
Copy link

You could also just drop your app into /home/username/webapps/yourappname/lib/python2.7/ since that's already in sys path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment