flask app for plurals to publicly share member lists

__init__.py 972B

123456789101112131415161718192021222324252627282930313233343536373839
  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__, instance_relative_config=True)
  6. app.config.from_mapping(
  7. SECRET_KEY='dev',
  8. DATABASE=os.path.join(app.instance_path, 'database.sqlite'),
  9. )
  10. if test_config is None:
  11. # load the instance config, if it exists, when not testing
  12. app.config.from_pyfile('config.py', silent=True)
  13. else:
  14. # load the test config if passed in
  15. app.config.from_mapping(test_config)
  16. # ensure the instance folder exists
  17. os.makedirs(app.instance_path, exist_ok=True)
  18. # a simple page that says hello
  19. @app.route('/hello')
  20. def hello():
  21. return 'Hello, World!'
  22. from . import db
  23. db.init_app(app)
  24. from . import auth
  25. app.register_blueprint(auth.bp)
  26. from . import home
  27. app.register_blueprint(home.bp)
  28. app.add_url_rule('/', endpoint='index')
  29. return app