messing around with flask tutorial

__init__.py 675B

1234567891011121314151617181920212223242526272829303132
  1. import os
  2. from flask import Flask
  3. def create_app(test_config=None):
  4. app = Flask(__name__, instance_relative_config=True)
  5. app.config.from_mapping(
  6. SECRET_KEY='dev',
  7. DATABASE=os.path.join(app.instance_path, 'flaskr.sqlite'),
  8. )
  9. if test_config is None:
  10. app.config.from_pyfile('config.py', silent=True)
  11. else:
  12. app.config.from_mapping(test_config)
  13. try:
  14. os.makedirs(app.instance_path)
  15. except OSError:
  16. pass
  17. @app.route('/hello')
  18. def hello():
  19. return 'Hello, World!'
  20. from . import db
  21. db.init_app(app)
  22. from . import auth
  23. app.register_blueprint(auth.bp)
  24. return app