Last active
March 10, 2024 18:26
-
-
Save Jaza/61f879f577bc9d06029e to your computer and use it in GitHub Desktop.
Revisions
-
Jaza revised this gist
Feb 6, 2015 . 2 changed files with 0 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +0,0 @@ File renamed without changes. -
Jaza revised this gist
Feb 6, 2015 . 3 changed files with 24 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,10 @@ """ Note: can't put in a subdirectory for this example (GitHub Gists doesn't allow subdirectories). Recommended to move this file to foo/bar.py. """ 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,10 @@ """ Note: can't put in a subdirectory for this example (GitHub Gists doesn't allow subdirectories). Recommended to move this file to foo/baz.py. """ 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,11 @@ """ Note: can't put in a subdirectory for this example (GitHub Gists doesn't allow subdirectories). Recommended to move this file to foo/__init__.py, and to change the imports to 'from .bar' and 'from .baz'. """ from flask import Blueprint @@ -9,8 +17,8 @@ def home(): return 'Foo home' from bar import routes as bar_routes from baz import routes as baz_routes routes = ( -
Jaza revised this gist
Feb 6, 2015 . 4 changed files with 66 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,3 @@ *.pyc 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ from flask import Blueprint mod = Blueprint('foo', __name__) @mod.route('/') def home(): return 'Foo home' from .bar import routes as bar_routes from .baz import routes as baz_routes routes = ( bar_routes + baz_routes) for r in routes: mod.add_url_rule( r['rule'], endpoint=r.get('endpoint', None), view_func=r['view_func'], **r.get('options', {})) 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ routes = [] def ping_bar(): return 'Ping bar' routes.append(dict( rule='/ping-bar/', view_func=ping_bar)) def save_bar(): return 'Save bar' routes.append(dict( rule='/save-bar/', view_func=save_bar, options=dict(methods=['POST',]))) 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ routes = [] def call_baz(): return 'Call baz' routes.append(dict( rule='/call-baz/', view_func=call_baz)) def delete_baz(): return 'Delete baz' routes.append(dict( rule='/delete-baz/', view_func=delete_baz, options=dict(methods=['GET', 'POST']))) -
Jaza renamed this gist
Feb 6, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Jaza revised this gist
Feb 6, 2015 . 2 changed files with 3 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ Flask==0.10.1 -
Jaza renamed this gist
Feb 6, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Jaza revised this gist
Feb 6, 2015 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ * -
Jaza created this gist
Feb 6, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ 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()