Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Print a customizable app name and other improvements #20

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# python-sample
The simplest posible webapp in flask.
This app responds to GET requests at / printing 'Hello World from {APP_NAME}!', where APP_NAME is optional and it is read from an environment variable.
It's compatible with python 3.8+.
5 changes: 3 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

@app.route('/')
def hello():
return 'Hello World!'
app_name = os.environ.get('APP_NAME', '[set APP_NAME env var]')
return 'Hello World from {}!'.format(app_name)

if __name__ == '__main__':
# Bind to PORT if defined, otherwise default to 5000.
port = int(os.environ.get('PORT', 5000))
app.run(host='0.0.0.0', port=port)
app.run(host='0.0.0.0', port=port)
10 changes: 6 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Flask==0.9
Jinja2==2.6
Werkzeug==0.8.3
wsgiref==0.1.2
click==7.1.2
Flask==1.1.2
itsdangerous==1.1.0
Jinja2==2.11.3
MarkupSafe==1.1.1
Werkzeug==1.0.1