From f8c50b7f1e57d3c212d95f7dc1085a3f0b58140a Mon Sep 17 00:00:00 2001 From: Suby Raman Date: Thu, 16 Feb 2017 11:46:19 -0500 Subject: [PATCH 1/2] fix blueprints documentation --- docs/sanic/blueprints.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/sanic/blueprints.md b/docs/sanic/blueprints.md index 02d387b2..5a3da7ec 100644 --- a/docs/sanic/blueprints.md +++ b/docs/sanic/blueprints.md @@ -153,8 +153,8 @@ from sanic import Sanic from blueprints import blueprint_v1, blueprint_v2 app = Sanic(__name__) -app.blueprint(blueprint_v1) -app.blueprint(blueprint_v2) +app.blueprint(blueprint_v1, url_prefix='/v1') +app.blueprint(blueprint_v2, url_prefix='/v2') app.run(host='0.0.0.0', port=8000, debug=True) ``` @@ -168,6 +168,7 @@ takes the format `.`. For example: @blueprint_v1.route('/') async def root(request): url = app.url_for('v1.post_handler', post_id=5) + # url = '/v1/post/5' return redirect(url) From 6ea5a4719a82beb531e5ccb79f1fa5a186c98d83 Mon Sep 17 00:00:00 2001 From: Suby Raman Date: Thu, 16 Feb 2017 11:48:31 -0500 Subject: [PATCH 2/2] add url_for doc in blueprint --- docs/sanic/blueprints.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/sanic/blueprints.md b/docs/sanic/blueprints.md index 5a3da7ec..cfeb58c7 100644 --- a/docs/sanic/blueprints.md +++ b/docs/sanic/blueprints.md @@ -167,8 +167,7 @@ takes the format `.`. For example: ``` @blueprint_v1.route('/') async def root(request): - url = app.url_for('v1.post_handler', post_id=5) - # url = '/v1/post/5' + url = app.url_for('v1.post_handler', post_id=5) # --> '/v1/post/5' return redirect(url)