Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View bottle.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
mkdir bottle
cd bottle
pip install virtualenv==12.0.7
virtualenv venv
source venv/bin/activate
pip install bottle==0.12.8
pip freeze > requirements.txt
git init
git add .
git commit -m "initial commit"
 
cat >app.py <<EOF
import os
from bottle import route, run, template
index_html = '''My first web app! By <strong>{{ author }}</strong>.'''
@route('/')
def index():
return template(index_html, author='Real Python')
@route('/name/<name>')
def name(name):
return template(index_html, author=name)
if __name__ == '__main__':
port = int(os.environ.get('PORT', 8080))
run(host='0.0.0.0', port=port, debug=True)
EOF
 
chmod a+x app.py
 
git init
git add .
git commit -m "Updated"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.