commit 3e052d3692de6cfe9d6e2dbfff9eb5094dff51ef Author: Xevion Date: Thu Aug 27 01:30:43 2020 -0500 add basic Flask server files diff --git a/server/config.py b/server/config.py new file mode 100644 index 0000000..b6a0e87 --- /dev/null +++ b/server/config.py @@ -0,0 +1,28 @@ +"""config.py +Stores all configurations for this Flask app. Would be used for storing storing and access development +and production secret keys. +""" + +import os + +configs = { + 'development': 'server.config.DevelopmentConfig', + 'production': 'server.config.ProductionConfig', + 'testing': 'server.config.TestingConfig' +} + + +class Config: + """Base configuration for the app.""" + + +class DevelopmentConfig(Config): + """Development configuration for the app.""" + + +class ProductionConfig(Config): + """Production configuration for the app.""" + + +class TestingConfig(Config): + """Testing configuraiton for the app.""" diff --git a/server/create_app.py b/server/create_app.py new file mode 100644 index 0000000..e06cced --- /dev/null +++ b/server/create_app.py @@ -0,0 +1,29 @@ +from flask import Flask, render_template + +from server.config import configs + +def create_app(env = None): + app = Flask( + __name__, + static_folder="./../dist/static", + template_folder="./../dist" + ) + + if not env: + env = app.config['ENV'] + app.config.from_object(configs[env]) + + @app.shell_context_processor + def shell_context(): + pass + + with app.app_context(): + #noinspection PyUnresolvedReferences + from server import api + + @app.route('/', defaults={'path': ''}) + @app.route('/') + def catch_all(path): + return render_template("index.html") + + return app diff --git a/wsgi.py b/wsgi.py new file mode 100644 index 0000000..e9d24fe --- /dev/null +++ b/wsgi.py @@ -0,0 +1,3 @@ +from server.create_app import create_app + +app = create_app()