Forked from Jaza/Flask-blueprint-with-imported-routes
Created
August 30, 2017 14:21
-
-
Save imaarthi/e11d8aa1634a542287440d3734d1286c 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
| * |
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
| env | |
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
| Flask==0.10.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment