Use flask.Blueprint:
|
app.add_url_rule('/api/answer', view_func=api.save_answer, methods=['POST']) |
|
app.add_url_rule('/api/admin/question', view_func=api.change_question_data, methods=['POST']) |
|
|
|
app.add_url_rule('/admin/', view_func=admin.admin_panel) |
|
app.add_url_rule('/admin/users/', view_func=admin.manage_users) |
|
app.add_url_rule('/admin/users/add', view_func=admin.add_users, methods=['GET', 'POST']) |
|
app.add_url_rule('/admin/users/addAdmin', view_func=admin.add_admin, methods=['POST']) |
|
app.add_url_rule('/admin/users/delete/<int:user_id>', view_func=admin.delete_user) |
|
app.add_url_rule('/admin/reset/<int:user_id>', view_func=admin.reset) |
|
app.add_url_rule('/admin/questions/', view_func=admin.manage_questions, methods=['GET', 'POST']) |
|
app.add_url_rule('/admin/questions/<int:question_id>', view_func=admin.edit_question, |
|
methods=['GET', 'POST']) |
|
app.add_url_rule('/admin/questions/import', view_func=admin.upload_questions, methods=['POST']) |
|
app.add_url_rule('/admin/questions/export', view_func=admin.export_questions) |
|
app.add_url_rule('/admin/questions/delete/<int:question_id>', view_func=admin.delete_question) |
Use
flask context processors or Jinja globals:
|
g.md = markdown |
|
g.supported = is_browser_supported() |
|
g.rand = randint |