| 123456789101112131415161718192021222324252627282930313233343536 |
- import os
-
- from flask import Flask
-
-
- def create_app(test_config=None):
- # create and configure the app
- app = Flask(__name__, instance_relative_config=True)
- app.config.from_mapping(
- SECRET_KEY='dev',
- DATABASE=os.path.join(app.instance_path, 'database.sqlite'),
- )
-
- # ensure the instance folder exists
- os.makedirs(app.instance_path, exist_ok=True)
-
- app.config.from_pyfile('config.py')
- #print(app.config["REGISTRATION"])
-
- from . import db
- db.init_app(app)
-
- from . import auth
- app.register_blueprint(auth.bp)
-
- from . import home
- app.register_blueprint(home.bp)
- app.add_url_rule('/', endpoint='index')
-
- from . import manage
- app.register_blueprint(manage.bp)
-
- from . import blog
- app.register_blueprint(blog.bp)
-
- return app
|