app.py 507 B

12345678910111213141516171819202122232425
  1. """
  2. """
  3. import os
  4. from flask import Flask
  5. from flask.ext.sqlalchemy import SQLAlchemy
  6. here = os.path.abspath(os.path.dirname(__file__))
  7. app = Flask(__name__)
  8. # Load configuration.
  9. conf_file = os.environ.get("CONFIG", None)
  10. if not conf_file:
  11. raise Exception("Missing CONFIG environment variable with the configuration")
  12. app.config.from_pyfile(conf_file)
  13. if app.config['DEBUG']:
  14. app.testing = True
  15. # Database initialization.
  16. db = SQLAlchemy(app)
  17. from database import models
  18. config = app.config