From 9ab1e9b8416f22ea6b8b89bf0de4a4321ead4329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Phillip=20K=C3=BChne?= Date: Fri, 20 Aug 2021 15:47:03 +0200 Subject: [PATCH] Adapt for Google Cloud Deployment --- backend/app/.gcloudignore | 19 +++++++++++++++++++ backend/app/app.yaml | 13 +++++++++++++ backend/app/database.py | 2 +- backend/app/main.py | 2 +- backend/app/requirements.txt | 4 ++++ 5 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 backend/app/.gcloudignore create mode 100644 backend/app/app.yaml create mode 100644 backend/app/requirements.txt diff --git a/backend/app/.gcloudignore b/backend/app/.gcloudignore new file mode 100644 index 0000000..a987f11 --- /dev/null +++ b/backend/app/.gcloudignore @@ -0,0 +1,19 @@ +# This file specifies files that are *not* uploaded to Google Cloud Platform +# using gcloud. It follows the same syntax as .gitignore, with the addition of +# "#!include" directives (which insert the entries of the given .gitignore-style +# file at that point). +# +# For more information, run: +# $ gcloud topic gcloudignore +# +.gcloudignore +# If you would like to upload your .git directory, .gitignore file or files +# from your .gitignore file, remove the corresponding line +# below: +.git +.gitignore + +# Python pycache: +__pycache__/ +# Ignored by the build system +/setup.cfg \ No newline at end of file diff --git a/backend/app/app.yaml b/backend/app/app.yaml new file mode 100644 index 0000000..db01bf4 --- /dev/null +++ b/backend/app/app.yaml @@ -0,0 +1,13 @@ +runtime: python39 + +handlers: + # This configures Google App Engine to serve the files in the app's static + # directory. +- url: /static + static_dir: static + + # This handler routes all requests not caught above to your main app. It is + # required when static routes are defined, but can be omitted (along with + # the entire handlers section) when there are no static files defined. +- url: /.* + script: auto \ No newline at end of file diff --git a/backend/app/database.py b/backend/app/database.py index 96b1c9a..a6d36f8 100644 --- a/backend/app/database.py +++ b/backend/app/database.py @@ -10,7 +10,7 @@ index_label = "Id" done_table = "done_songs" def open_db(): - conn = sqlite3.connect("data/test.db") + conn = sqlite3.connect("/tmp/karaoqueue.db") conn.execute('PRAGMA encoding = "UTF-8";') return conn diff --git a/backend/app/main.py b/backend/app/main.py index e163ee4..cad59ac 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -152,4 +152,4 @@ def activate_job(): if __name__ == "__main__": - app.run(debug=True, host='0.0.0.0') + app.run(host='127.0.0.1', port=8080, debug=True) diff --git a/backend/app/requirements.txt b/backend/app/requirements.txt new file mode 100644 index 0000000..8b49195 --- /dev/null +++ b/backend/app/requirements.txt @@ -0,0 +1,4 @@ +requests +pandas +Flask-BasicAuth +bs4 \ No newline at end of file