DEV Community

loading...

What is the best Framework for Creating RESTful API: Django vs Flask

thammuio profile image Suri Nuthalapati ・1 min read

What is the best(Django vs Flask) framework to build just the REST API without UI part, and which one works better with MongoDB.

Discussion

pic
Editor guide
Collapse
steelwolf180 profile image
Max Ong Zong Bao

It depends on your use case, if your going with Django it's not advised to use MongoDB but opt for PostGres.

If your planning to use Flask go MongoDB instead by PyDanny.

who is one of the maintainer of cookiecutter project and other Django related projects plus his book called Two Scoops of Django was my goto book when I first started out developing in Django

You can look at the reasoning on why at this When to Use MongoDB with Django

Collapse
svinci profile image
Sebastian G. Vinci

I don't think of Flask as a framework, but rather a library. It is lightweight.

Django, on the other side, is a full fledged framework with a whole lot of features. We are talking ORM, server side rendering, REST and Web features.

Flask will not solve any issue regarding MongoDB, but you can get a library there and work with that. Django, AFAIK, does not work well with Mongo.

I would stick with Flask if you just want a REST API, without UI. And I also recommend connexion.

Collapse
morabaraba profile image
Morabaraba

Best will always be relative.

Personally I recommend you look at connexion that is built on top of Flask.

Collapse
thammuio profile image
Suri Nuthalapati Author

Thank you.. Let me check it out...