No Description

__init__.py 730B

123456789101112131415161718192021222324252627282930
  1. import os
  2. from flask import Flask
  3. def create_app(test_config=None):
  4. # create and configure the app
  5. app = Flask(__name__)
  6. app.config.from_mapping(
  7. SECRET_KEY='dev')
  8. if test_config is None:
  9. # load the instance config, if it exists, when not testing
  10. app.config.from_pyfile('config.py', silent=True)
  11. else:
  12. # load the test config if passed in
  13. app.config.from_mapping(test_config)
  14. # ensure the instance folder exists
  15. try:
  16. os.makedirs(app.instance_path)
  17. except OSError:
  18. pass
  19. from articles_api.articles.articles import articles_api_bp
  20. app.register_blueprint(articles_api_bp)
  21. app.add_url_rule('/', endpoint="index")
  22. return app