diff --git a/__init__.py b/app/__init__.py similarity index 77% rename from __init__.py rename to app/__init__.py index 8f57bd2..14dc7fb 100644 --- a/__init__.py +++ b/app/__init__.py @@ -1,7 +1,10 @@ from flask import Flask from flask_sqlalchemy import SQLAlchemy +import os app = Flask(__name__) + +config_string = os.environ.get("FLASK_CONFIG", "config.DevelopmentConfig") app.config.from_object("config.DevelopmentConifg") app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///app.db" app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False diff --git a/requirements.txt b/app/requirements.txt similarity index 100% rename from requirements.txt rename to app/requirements.txt diff --git a/routes.py b/app/routes.py similarity index 100% rename from routes.py rename to app/routes.py diff --git a/tasks.py b/app/tasks.py similarity index 100% rename from tasks.py rename to app/tasks.py diff --git a/templates/includes/footer.html b/app/templates/includes/footer.html similarity index 100% rename from templates/includes/footer.html rename to app/templates/includes/footer.html diff --git a/templates/includes/header.html b/app/templates/includes/header.html similarity index 100% rename from templates/includes/header.html rename to app/templates/includes/header.html diff --git a/templates/layouts/base.html b/app/templates/layouts/base.html similarity index 100% rename from templates/layouts/base.html rename to app/templates/layouts/base.html diff --git a/templates/pages/index.html b/app/templates/pages/index.html similarity index 100% rename from templates/pages/index.html rename to app/templates/pages/index.html diff --git a/config.py b/config.py new file mode 100644 index 0000000..a4dbd1b --- /dev/null +++ b/config.py @@ -0,0 +1,29 @@ +from pathlib import Path +import os + +class Config: + APP_NAME = "APP_NAME" + DEBUG = False + TESTING = False + + SECRET_KEY = "Change this to something secure" + APP_ROOT = os.path.join(Path(__file__).parent, "app") + + DB_NAME = "app.db" + DB_USERNAME = "" + DB_PASSWORD = "" + SQLALCHEMY_DATABASE_URI = f"sqlite:///{DB_NAME}" + SQLALCHEMY_TRACK_MODIFICATIONS = False + HOST = "127.0.0.1" + + + UPLOAD_FOLDER = f"{APP_ROOT}/static/generated_audio" + +class DevelopmentConifg(Config): + DEBUG = True + +class ProductionConfig(Config): + HOST = "0.0.0.0" + +class TestingConfig(Config): + TESTING = True diff --git a/run.py b/run.py new file mode 100644 index 0000000..3a43937 --- /dev/null +++ b/run.py @@ -0,0 +1,4 @@ +from app import app + +if __name__ == '__main__': + app.run()