From 541f6db62adaf75d3f09e773faa46ed83823283b Mon Sep 17 00:00:00 2001 From: Christian Ramseyer Date: Fri, 7 Jan 2022 22:51:50 +0100 Subject: [PATCH 1/6] Update app.py --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index cad286e..82aacea 100644 --- a/app.py +++ b/app.py @@ -5,7 +5,7 @@ @app.route('/') def hello(): - return "Hello World!" + return "Hello World (forked)!" if __name__ == '__main__': serve(app, host='0.0.0.0', port=8080) From 4b7d895af8ecf86a4544ab3d4254657f2af5e8a9 Mon Sep 17 00:00:00 2001 From: Christian Ramseyer Date: Sat, 8 Jan 2022 00:41:55 +0100 Subject: [PATCH 2/6] update 1 --- .gitignore | 5 ++++- app.py | 9 ++++++++- requirements.txt | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 4504216..0f9d951 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ .odo/env -.odo/odo-file-index.json \ No newline at end of file +.odo/odo-file-index.json +venv +.vscode +__pycache__ diff --git a/app.py b/app.py index 82aacea..da72a28 100644 --- a/app.py +++ b/app.py @@ -1,11 +1,18 @@ from flask import Flask from waitress import serve +import os app = Flask(__name__) @app.route('/') def hello(): - return "Hello World (forked)!" + out = ["Hello World (forked)!"] + for k, v in os.environ.items(): + out.append(f'{k}={v}') + return str.join("
\n", out) + + +# to run: FLASK_APP=app python -m flask run if __name__ == '__main__': serve(app, host='0.0.0.0', port=8080) diff --git a/requirements.txt b/requirements.txt index df68bec..cec3c8a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ Flask==1.1.2 -waitress==2.0.0 \ No newline at end of file +waitress==2.0.0 From b28e2b229adf0fd0d5009abb44919b2f74d39efc Mon Sep 17 00:00:00 2001 From: Christian Ramseyer Date: Sat, 8 Jan 2022 00:50:44 +0100 Subject: [PATCH 3/6] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d624098..8f4feb4 100644 --- a/README.md +++ b/README.md @@ -1 +1,4 @@ -# devfile-sample-python-basic \ No newline at end of file +# devfile-sample-python-basic + + * added venv to run locally + * added webhook to automatically build on commit From c56ce9e88a3000a52e509cc12261557c19d021a7 Mon Sep 17 00:00:00 2001 From: Christian Ramseyer Date: Sat, 8 Jan 2022 01:02:58 +0100 Subject: [PATCH 4/6] add stuff --- requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements.txt b/requirements.txt index cec3c8a..66aac83 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,4 @@ Flask==1.1.2 waitress==2.0.0 +black +pylint From 61dfc758e4ce2db8a0c74fe0aac78112d7dafd24 Mon Sep 17 00:00:00 2001 From: Christian Ramseyer Date: Sat, 8 Jan 2022 01:16:26 +0100 Subject: [PATCH 5/6] filter output --- app.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index da72a28..e7ae863 100644 --- a/app.py +++ b/app.py @@ -7,8 +7,9 @@ @app.route('/') def hello(): out = ["Hello World (forked)!"] - for k, v in os.environ.items(): - out.append(f'{k}={v}') + for k in [ k for k in os.environ.keys() if k in ['PATH', 'TERM', 'HOSTNAME']]: + print(f"k {k}") + out.append(f'{k}={os.environ[k]}') return str.join("
\n", out) From 24a074a7279e4253e16866d66574dffc96cd43a8 Mon Sep 17 00:00:00 2001 From: Christian Ramseyer Date: Sat, 8 Jan 2022 22:46:52 +0100 Subject: [PATCH 6/6] trying to add postgres container --- devfile.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/devfile.yaml b/devfile.yaml index 5e26502..4a35a94 100644 --- a/devfile.yaml +++ b/devfile.yaml @@ -27,6 +27,13 @@ components: endpoints: - name: web targetPort: 8080 + - name: postgres + container: + image: postgres:14 + mountSources: true + endpoints: + - name: postgres-endpoint + targetPort: 5432 commands: - id: pip-install-requirements exec: @@ -43,6 +50,12 @@ commands: group: kind: run isDefault: true + - id: run-db + exec: + component: postgres + group: + kind: run + isDefault: true - id: debugpy exec: commandLine: "pip install --user debugpy && python -m debugpy --listen 0.0.0.0:${DEBUG_PORT} app.py"