From 895dd14073b21035c62c5f06240325a112f0c04c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Phillip=20K=C3=BChne?= Date: Fri, 15 Jul 2022 02:07:40 +0200 Subject: [PATCH] Refactor for heroku --- .vscode/launch.json | 16 ++++++++-------- .vscode/tasks.json | 2 +- Procfile | 1 + backend/{app => }/.gcloudignore | 0 backend/{app => }/app.yaml | 0 backend/{app => }/data_adapters.py | 0 backend/{app => }/database.py | 0 backend/{app => }/helpers.py | 0 backend/{app => }/main.py | 2 +- backend/{app => }/requirements.txt | 0 backend/{app => }/static/css/style.css | 0 backend/{app => }/static/favicon.ico | Bin .../static/images/touch/homescreen512.png | Bin backend/{app => }/static/manifest.webmanifest | 0 backend/{app => }/templates/base.html | 0 backend/{app => }/templates/main.html | 0 backend/{app => }/templates/main_admin.html | 0 backend/{app => }/templates/played_list.html | 0 backend/{app => }/templates/settings.html | 0 backend/{app => }/templates/songlist.html | 0 20 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 Procfile rename backend/{app => }/.gcloudignore (100%) rename backend/{app => }/app.yaml (100%) rename backend/{app => }/data_adapters.py (100%) rename backend/{app => }/database.py (100%) rename backend/{app => }/helpers.py (100%) rename backend/{app => }/main.py (99%) rename backend/{app => }/requirements.txt (100%) rename backend/{app => }/static/css/style.css (100%) rename backend/{app => }/static/favicon.ico (100%) rename backend/{app => }/static/images/touch/homescreen512.png (100%) rename backend/{app => }/static/manifest.webmanifest (100%) rename backend/{app => }/templates/base.html (100%) rename backend/{app => }/templates/main.html (100%) rename backend/{app => }/templates/main_admin.html (100%) rename backend/{app => }/templates/played_list.html (100%) rename backend/{app => }/templates/settings.html (100%) rename backend/{app => }/templates/songlist.html (100%) diff --git a/.vscode/launch.json b/.vscode/launch.json index 900d079..1d2931e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,11 +8,11 @@ "preLaunchTask": "versiondump", "name": "Python: Flask", "type": "python", - "cwd": "${workspaceFolder}/backend/app", + "cwd": "${workspaceFolder}/backend", "request": "launch", "module": "flask", "env": { - "FLASK_APP": "backend/app/main.py", + "FLASK_APP": "backend/main.py", "FLASK_ENV": "development", "FLASK_DEBUG": "1" }, @@ -27,11 +27,11 @@ "preLaunchTask": "versiondump", "name": "Python: Flask (with reload)", "type": "python", - "cwd": "${workspaceFolder}/backend/app", + "cwd": "${workspaceFolder}/backend", "request": "launch", "module": "flask", "env": { - "FLASK_APP": "backend/app/main.py", + "FLASK_APP": "backend/main.py", "FLASK_ENV": "development", "FLASK_DEBUG": "1" }, @@ -45,11 +45,11 @@ "preLaunchTask": "versiondump", "name": "Python: Flask (with reload, externally reachable)", "type": "python", - "cwd": "${workspaceFolder}/backend/app", + "cwd": "${workspaceFolder}/backend", "request": "launch", "module": "flask", "env": { - "FLASK_APP": "backend/app/main.py", + "FLASK_APP": "backend/main.py", "FLASK_ENV": "development", "FLASK_DEBUG": "1" }, @@ -64,11 +64,11 @@ "preLaunchTask": "versiondump", "name": "Python: Flask (externally reachable)", "type": "python", - "cwd": "${workspaceFolder}/backend/app", + "cwd": "${workspaceFolder}/backend", "request": "launch", "module": "flask", "env": { - "FLASK_APP": "backend/app/main.py", + "FLASK_APP": "backend/main.py", "FLASK_ENV": "development", "FLASK_DEBUG": "1" }, diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 054def4..563a855 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -6,7 +6,7 @@ { "label": "versiondump", "type": "shell", - "command": "echo \"$(git rev-parse --abbrev-ref HEAD)-$(git describe)\"> ${workspaceFolder}/backend/app/.version", + "command": "echo \"$(git rev-parse --abbrev-ref HEAD)-$(git describe)\"> ${workspaceFolder}/backend/.version", "problemMatcher": [] } ] diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..7a9aa8f --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: gunicorn backend/main:app \ No newline at end of file diff --git a/backend/app/.gcloudignore b/backend/.gcloudignore similarity index 100% rename from backend/app/.gcloudignore rename to backend/.gcloudignore diff --git a/backend/app/app.yaml b/backend/app.yaml similarity index 100% rename from backend/app/app.yaml rename to backend/app.yaml diff --git a/backend/app/data_adapters.py b/backend/data_adapters.py similarity index 100% rename from backend/app/data_adapters.py rename to backend/data_adapters.py diff --git a/backend/app/database.py b/backend/database.py similarity index 100% rename from backend/app/database.py rename to backend/database.py diff --git a/backend/app/helpers.py b/backend/helpers.py similarity index 100% rename from backend/app/helpers.py rename to backend/helpers.py diff --git a/backend/app/main.py b/backend/main.py similarity index 99% rename from backend/app/main.py rename to backend/main.py index a36000c..ce24fa9 100644 --- a/backend/app/main.py +++ b/backend/main.py @@ -6,7 +6,7 @@ import os import json from flask_basicauth import BasicAuth from helpers import nocache -app = Flask(__name__, static_url_path='/static') +app = Flask("backend", static_url_path='/static') basic_auth = BasicAuth(app) accept_entries = False diff --git a/backend/app/requirements.txt b/backend/requirements.txt similarity index 100% rename from backend/app/requirements.txt rename to backend/requirements.txt diff --git a/backend/app/static/css/style.css b/backend/static/css/style.css similarity index 100% rename from backend/app/static/css/style.css rename to backend/static/css/style.css diff --git a/backend/app/static/favicon.ico b/backend/static/favicon.ico similarity index 100% rename from backend/app/static/favicon.ico rename to backend/static/favicon.ico diff --git a/backend/app/static/images/touch/homescreen512.png b/backend/static/images/touch/homescreen512.png similarity index 100% rename from backend/app/static/images/touch/homescreen512.png rename to backend/static/images/touch/homescreen512.png diff --git a/backend/app/static/manifest.webmanifest b/backend/static/manifest.webmanifest similarity index 100% rename from backend/app/static/manifest.webmanifest rename to backend/static/manifest.webmanifest diff --git a/backend/app/templates/base.html b/backend/templates/base.html similarity index 100% rename from backend/app/templates/base.html rename to backend/templates/base.html diff --git a/backend/app/templates/main.html b/backend/templates/main.html similarity index 100% rename from backend/app/templates/main.html rename to backend/templates/main.html diff --git a/backend/app/templates/main_admin.html b/backend/templates/main_admin.html similarity index 100% rename from backend/app/templates/main_admin.html rename to backend/templates/main_admin.html diff --git a/backend/app/templates/played_list.html b/backend/templates/played_list.html similarity index 100% rename from backend/app/templates/played_list.html rename to backend/templates/played_list.html diff --git a/backend/app/templates/settings.html b/backend/templates/settings.html similarity index 100% rename from backend/app/templates/settings.html rename to backend/templates/settings.html diff --git a/backend/app/templates/songlist.html b/backend/templates/songlist.html similarity index 100% rename from backend/app/templates/songlist.html rename to backend/templates/songlist.html