Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between namespaces and blueprints in flask-restful and flask

I am unable to understand the what purpose does blueprints and namespaces serve in web app. I read the documentation but cannot figure it out exactly.
It would be really helpful for me if you give a simple explanation with example for each case.
Thanks!

like image 543
handsomer223 Avatar asked May 14 '18 09:05

handsomer223


1 Answers

I may still be missing something, but this tutorial seems to clarify the documentation a bit more.

Regarding @code_dredd's comment:

why should anyone choose to use a Blueprint over a Namespace (or viceversa) when both claim to have the same purpose?

Namespaces appear to be intended for organizing REST endpoints within a given API, whereas Blueprints, in this context, appear to be intended for allowing multiple APIs to be mixed and matched with other APIs or non-REST routes on a Flask App, according to Flask's design specification.

like image 198
ipetrik Avatar answered Sep 19 '22 22:09

ipetrik