Forked from Jaza/Flask-blueprint-with-imported-routes
Created
February 1, 2016 15:38
-
-
Save 3k/87fc7e04cc92c3f81b07 to your computer and use it in GitHub Desktop.
Example of how to split a Flask blueprint into multiple files, with routes in each file, and of how to register all those routes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask | |
| app = Flask(__name__) | |
| app.debug = True | |
| @app.route('/') | |
| def home(): | |
| return 'App home' | |
| from foo import mod | |
| app.register_blueprint(mod, url_prefix='/foo') | |
| if __name__ == '__main__': | |
| app.run() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment