flaskr.py 944 B

1234567891011121314151617181920212223242526272829303132
  1. """
  2. Simple flask thing
  3. """
  4. from flask import redirect, flash, render_template
  5. from app import app
  6. from app.modules.static import Static
  7. from app.modules.backend import Backend
  8. from app.modules.auth import Auth
  9. from app.modules.backend.modules.page import Backend_Page
  10. from app.modules.backend.modules.file import Backend_File
  11. from app.modules.backend.modules.user import Backend_User
  12. app.register_blueprint(Auth)
  13. app.register_blueprint(Static)
  14. app.register_blueprint(Backend, url_prefix='/backend')
  15. app.register_blueprint(Backend_Page, url_prefix='/backend/page')
  16. app.register_blueprint(Backend_File, url_prefix='/backend/file')
  17. app.register_blueprint(Backend_User, url_prefix='/backend/user')
  18. @app.errorhandler(404)
  19. def page_not_found(error):
  20. return render_template("error/404.html")
  21. @app.errorhandler(401)
  22. def login_required(error):
  23. flash('Please login before opening page', 'warning')
  24. return redirect('/login', code=302)