Created
March 6, 2012 13:19
-
-
Save geoffalday/1986240 to your computer and use it in GitHub Desktop.
Getting a Python/Flask app running on Webfaction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
app = Flask(__name__) | |
@app.route('/') | |
def hello_world(): | |
return 'Hello World!' | |
if __name__ == '__main__': | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could also just drop your app into /home/username/webapps/yourappname/lib/python2.7/ since that's already in sys path.