No Description

__init__.py 901B

1234567891011121314151617181920212223242526272829303132333435
  1. import os
  2. from flask import Flask
  3. from flask_mail import Mail
  4. app = Flask(__name__, instance_relative_config=True)
  5. app.config.from_mapping(
  6. SECRET_KEY=os.environ.get('SECRET_KEY'),
  7. DATABASE=os.path.join(app.instance_path, 'upr_espera.sqlite'),
  8. MAIL_SERVER='smtp.googlemail.com',
  9. MAIL_PORT=587,
  10. MAIL_USE_TLS=1,
  11. MAIL_USERNAME=os.environ.get('MAIL_USERNAME'),
  12. MAIL_PASSWORD=os.environ.get('MAIL_PASSWORD'),
  13. )
  14. mail = Mail(app)
  15. try:
  16. os.makedirs(app.instance_path)
  17. except OSError:
  18. pass
  19. from . import db
  20. db.init_app(app)
  21. from . import index
  22. app.register_blueprint(index.bp)
  23. app.add_url_rule('/', endpoint='index')
  24. from . import admin_insert
  25. app.register_blueprint(admin_insert.bp)
  26. app.add_url_rule('/admin_insert', endpoint='admin_insert')
  27. from . import admin_remove
  28. app.register_blueprint(admin_remove.bp)
  29. app.add_url_rule('/admin_remove', endpoint='admin_remove')