From 43f9d78f8c00e13732b809519f0529ac293fd5ab Mon Sep 17 00:00:00 2001 From: Mitsuo Tokumori Date: Sun, 29 Oct 2023 07:41:04 -0500 Subject: Rename to ustayml (u-stayML) --- ustayml/__init__.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 ustayml/__init__.py (limited to 'ustayml/__init__.py') diff --git a/ustayml/__init__.py b/ustayml/__init__.py new file mode 100644 index 0000000..1c411e7 --- /dev/null +++ b/ustayml/__init__.py @@ -0,0 +1,44 @@ +import os + +from flask import Flask + + +def create_app(test_config=None): + # Create app object. Configuration files are relative to instance folder. + app = Flask(__name__, instance_relative_config=True) + + # Config + app.config.from_mapping( + SECRET_KEY='dev', + DATABASE=os.path.join(app.instance_path, 'ustayml.sqlite'), + ) + + if test_config is None: + app.config.from_pyfile('config.py', silent=True) + else: + app.config.from_mapping(test_config) + + try: + os.makedirs(app.instance_path) + except OSError: + pass + + # Routes + @app.route('/hello') + def hello(): + return 'Hello, World!' + + # Register functions and blueprints + from . import db + db.init_app(app) + + from .views import auth + app.register_blueprint(auth.bp) + + from .views import blog + app.register_blueprint(blog.bp) + + # Extra + app.add_url_rule('/', endpoint='index') + + return app \ No newline at end of file -- cgit v1.2.3