Skip to content

Instantly share code, notes, and snippets.

@nzoschke
Created May 31, 2011 14:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nzoschke/efec5e060e88abc87821 to your computer and use it in GitHub Desktop.
Save nzoschke/efec5e060e88abc87821 to your computer and use it in GitHub Desktop.
Python
~/app $ cat >hello.py <<EOF
import os
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
port = int(os.environ.get("PORT", 5000))
app.run(host='0.0.0.0', port=port)
EOF
~/app $ cat >requirements.txt <<EOF
Flask==0.6.1
EOF
~/app $ cat >Procfile <<EOF
web: bin/python hello.py
EOF
~/app $ git init
Initialized empty Git repository in ~app/.git/
~/app $ git add .
~/app $ git commit -m init
[master (root-commit) 1fb53d5] init
3 files changed, 13 insertions(+), 0 deletions(-)
create mode 100644 Procfile
create mode 100644 hello.py
create mode 100644 requirements.txt
~/app $ heroku create --stack cedar
Creating stormy-cloud-533... done, stack is cedar
http://stormy-cloud-533.herokuapp.com/ | git@heroku.com:stormy-cloud-533.git
Git remote heroku added
~/app $ git push heroku master
-----> Heroku receiving push
-----> Python app detected
-----> Preparing virtualenv version 1.6.1
New python executable in ./bin/python2.7
Also creating executable in ./bin/python
Installing setuptools............done.
Installing pip...............done.
-----> Byte-compiling code
-----> Installing dependencies using pip version 1.0.1
Downloading/unpacking Flask==0.6.1 (from -r requirements.txt (line 1))
Creating supposed download cache at /tmp/repos/545015/.cache/pip_downloads
Storing download in cache at /tmp/repos/545015/.cache/pip_downloads/http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2FF%2FFlask%2FFlask-0.6.1.tar.gz
Running setup.py egg_info for package Flask
Downloading/unpacking Werkzeug>=0.6.1 (from Flask==0.6.1->-r requirements.txt (line 1))
Storing download in cache at /tmp/repos/545015/.cache/pip_downloads/http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2FW%2FWerkzeug%2FWerkzeug-0.6.2.tar.gz
Running setup.py egg_info for package Werkzeug
Downloading/unpacking Jinja2>=2.4 (from Flask==0.6.1->-r requirements.txt (line 1))
Storing download in cache at /tmp/repos/545015/.cache/pip_downloads/http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2FJ%2FJinja2%2FJinja2-2.5.5.tar.gz
Running setup.py egg_info for package Jinja2
Installing collected packages: Flask, Werkzeug, Jinja2
Running setup.py install for Flask
Running setup.py install for Werkzeug
Running setup.py install for Jinja2
Successfully installed Flask Werkzeug Jinja2
Cleaning up...
-----> Discovering process types
Procfile declares types -> web
-----> Compiled slug size is 3.3MB
-----> Launching... done, v5
http://stormy-cloud-533.herokuapp.com deployed to Heroku
~/app $ curl http://stormy-cloud-533.herokuapp.com
Hello World!
import os
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
port = int(os.environ.get("PORT", 5000))
app.run(host='0.0.0.0', port=port)
web: bin/python hello.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment