Skip to content
This repository has been archived by the owner on Jul 24, 2019. It is now read-only.

Commit

Permalink
Merge pull request #3 from mboersma/flask-refresh
Browse files Browse the repository at this point in the history
Update flask version and README.md example output
  • Loading branch information
mboersma committed May 26, 2015
2 parents 879de4a + 4c579c0 commit 774eded
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 83 deletions.
147 changes: 71 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,95 +1,90 @@
# Python Quick Start Guide

This guide will walk you through deploying a Python application on Deis.
This guide will walk you through deploying a Python / Flask application on Deis.

## Usage

```
```console
$ git clone https://github.com/deis/example-python-flask.git
$ cd example-python-flask
$ deis create
Creating application... done, created timely-darkroom
Creating application... done, created padded-gemstone
Git remote deis added
$ git push deis master
Counting objects: 80, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (44/44), done.
Writing objects: 100% (80/80), 18.60 KiB | 0 bytes/s, done.
Total 80 (delta 29), reused 80 (delta 29)
Counting objects: 96, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (86/86), done.
Writing objects: 100% (96/96), 20.88 KiB | 0 bytes/s, done.
Total 96 (delta 38), reused 0 (delta 0)
-----> Python app detected
-----> No runtime.txt provided; assuming python-2.7.6.
-----> Preparing Python runtime (python-2.7.6)
-----> Installing Setuptools (2.1)
-----> Installing Pip (1.5.4)
-----> Installing dependencies using Pip (1.5.4)
Downloading/unpacking Flask==0.9 (from -r requirements.txt (line 1))
Running setup.py (path:/tmp/pip_build_root/Flask/setup.py) egg_info for package Flask
warning: no files found matching '*' under directory 'tests'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'docs/_themes/.git'
Downloading/unpacking Jinja2==2.6 (from -r requirements.txt (line 2))
Running setup.py (path:/tmp/pip_build_root/Jinja2/setup.py) egg_info for package Jinja2
Downloading/unpacking gunicorn==0.17.2 (from -r requirements.txt (line 3))
Running setup.py (path:/tmp/pip_build_root/gunicorn/setup.py) egg_info for package gunicorn
-----> Installing runtime (python-2.7.9)
-----> Installing dependencies with pip
Collecting Flask==0.10.1 (from -r requirements.txt (line 1))
Downloading Flask-0.10.1.tar.gz (544kB)
Collecting Jinja2==2.7.3 (from -r requirements.txt (line 2))
Downloading Jinja2-2.7.3.tar.gz (378kB)
Collecting gunicorn==19.3.0 (from -r requirements.txt (line 3))
Downloading gunicorn-19.3.0-py2.py3-none-any.whl (110kB)
Collecting Werkzeug>=0.7 (from Flask==0.10.1->-r requirements.txt (line 1))
Downloading Werkzeug-0.10.4-py2.py3-none-any.whl (293kB)
Collecting itsdangerous>=0.21 (from Flask==0.10.1->-r requirements.txt (line 1))
Downloading itsdangerous-0.24.tar.gz (46kB)
Collecting markupsafe (from Jinja2==2.7.3->-r requirements.txt (line 2))
Downloading MarkupSafe-0.23.tar.gz
Installing collected packages: Werkzeug, markupsafe, Jinja2, itsdangerous, Flask, gunicorn
Running setup.py install for markupsafe
Running setup.py install for Jinja2
Running setup.py install for itsdangerous
Running setup.py install for Flask
Successfully installed Flask-0.10.1 Jinja2-2.7.3 Werkzeug-0.10.4 gunicorn-19.3.0 itsdangerous-0.24 markupsafe-0.23

Downloading/unpacking Werkzeug>=0.7 (from Flask==0.9->-r requirements.txt (line 1))
Running setup.py (path:/tmp/pip_build_root/Werkzeug/setup.py) egg_info for package Werkzeug
-----> Discovering process types
Procfile declares types -> web
-----> Compiled slug size is 38M

warning: no files found matching '*' under directory 'werkzeug/debug/templates'
warning: no files found matching '*' under directory 'tests'
no previously-included directories found matching 'docs/_build'
Installing collected packages: Flask, Jinja2, gunicorn, Werkzeug
Running setup.py install for Flask
-----> Building Docker image
remote: Sending build context to Docker daemon 39.45 MB
remote: build context to Docker daemon
Step 0 : FROM deis/slugrunner
---> 385e8129fbdf
Step 1 : RUN mkdir -p /app
---> Using cache
---> 877ce2869c1c
Step 2 : WORKDIR /app
---> Using cache
---> 40b847b64730
Step 3 : ENTRYPOINT /runner/init
---> Using cache
---> fe7cf39f55ff
Step 4 : ADD slug.tgz /app
---> 0dab16cd6994
Removing intermediate container 2121d50679e5
Step 5 : ENV GIT_SHA 91e48e7f071dd70676dd3d050421aaab52687ee8
---> Running in eb00fd106d3b
---> c66474feaa32
Removing intermediate container eb00fd106d3b
Successfully built c66474feaa32
-----> Pushing image to private registry

warning: no files found matching '*' under directory 'tests'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'docs/_themes/.git'
Running setup.py install for Jinja2
-----> Launching...
done, padded-gemstone:v2 deployed to Deis

Running setup.py install for gunicorn
http://padded-gemstone.local3.deisapp.com

Installing gunicorn_paster script to /app/.heroku/python/bin
Installing gunicorn script to /app/.heroku/python/bin
Installing gunicorn_django script to /app/.heroku/python/bin
Running setup.py install for Werkzeug
To learn more, use `deis help` or visit http://deis.io

warning: no files found matching '*' under directory 'werkzeug/debug/templates'
warning: no files found matching '*' under directory 'tests'
no previously-included directories found matching 'docs/_build'
Successfully installed Flask Jinja2 gunicorn Werkzeug
Cleaning up...
-----> Discovering process types
Procfile declares types -> web
-----> Compiled slug size is 31M
remote: -----> Building Docker image
remote: Uploading context 31.75 MB
remote: Uploading context
remote: Step 0 : FROM deis/slugrunner
remote: ---> 5567a808891d
remote: Step 1 : RUN mkdir -p /app
remote: ---> Using cache
remote: ---> 4096b5c0b838
remote: Step 2 : ADD slug.tgz /app
remote: ---> c2c3aa045300
remote: Removing intermediate container bc85fb8c3b74
remote: Step 3 : ENTRYPOINT ["/runner/init"]
remote: ---> Running in c919bc22157f
remote: ---> d5bd87f455c8
remote: Removing intermediate container c919bc22157f
remote: Successfully built d5bd87f455c8
remote: -----> Pushing image to private registry
remote:
remote: Launching... done, v2
remote:
remote: -----> timely-darkroom deployed to Deis
remote: http://timely-darkroom.local.deisapp.com
remote:
remote: To learn more, use `deis help` or visit http://deis.io
remote:
To ssh://git@local.deisapp.com:2222/timely-darkroom.git
To ssh://git@deis.local3.deisapp.com:2222/padded-gemstone.git
* [new branch] master -> master
$ curl http://timely-darkroom.local.deisapp.com
Powered by Deis!
$ curl http://padded-gemstone.local3.deisapp.com
Powered by Deis
$ deis config:set POWERED_BY="Engine Yard"
Creating config... done, v3

=== padded-gemstone
DEIS_APP: padded-gemstone
POWERED_BY: Engine Yard
$ curl http://padded-gemstone.local3.deisapp.com
Powered by Engine Yard
```

## Additional Resources
Expand Down
17 changes: 13 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
import os
"""
Example python app with the Flask framework: http://flask.pocoo.org/
"""

from os import environ

from flask import Flask
from flask import render_template


app = Flask(__name__)


@app.route('/')
def hello():
return 'Powered by {}'.format(os.environ.get('POWERED_BY', 'Deis!'))
def index():
return render_template('index.html',
powered_by=environ.get('POWERED_BY', 'Deis'))

if __name__ == '__main__':
# Bind to PORT if defined, otherwise default to 5000.
port = int(os.environ.get('PORT', 5000))
port = int(environ.get('PORT', 5000))
app.run(host='0.0.0.0', port=port)
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Flask==0.9
Jinja2==2.6
gunicorn==0.17.2
Flask==0.10.1
Jinja2==2.7.3
gunicorn==19.3.0
1 change: 1 addition & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Powered by {{ powered_by }}

0 comments on commit 774eded

Please sign in to comment.