diff --git a/README.md b/README.md new file mode 100644 index 0000000..7301f09 --- /dev/null +++ b/README.md @@ -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+. diff --git a/app.py b/app.py index f64c9e7..4b5c2f2 100644 --- a/app.py +++ b/app.py @@ -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) \ No newline at end of file + app.run(host='0.0.0.0', port=port) diff --git a/requirements.txt b/requirements.txt index 0382aa2..e4c5de6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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