Created
June 13, 2011 15:47
-
-
Save hitezh/1023027 to your computer and use it in GitHub Desktop.
Bottle on Dreamhost
This file contains hidden or 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
# Detailed explanation at http://hitesh.in/2011/running-a-bottle-py-app-on-dreamhost/ | |
#1. Add current directory to path, if isn't already | |
import os, sys | |
cmd_folder = os.path.dirname(os.path.abspath(__file__)) | |
if cmd_folder not in sys.path: | |
sys.path.insert(0, cmd_folder) | |
import bottle | |
from bottle import route, run | |
#2. Define needed routes here | |
@route('/') | |
def index(): | |
return "it works!" | |
#3. setup dreamhost passenger hook | |
def application(environ, start_response): | |
return bottle.default_app().wsgi(environ,start_response) | |
#4. Main method for local developement | |
if __name__ == "__main__": | |
bottle.debug(True) | |
run(reloader=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment