Why doesn’t the Django framework come with its own REST API out of the box?
20th September 2012
My answer to Why doesn’t the Django framework come with its own REST API out of the box? on Quora
I’d argue that it does. If you want to build a REST API you need to be able to map incoming HTTP requests to handler functions based on their URL, run some custom code and return an HTTP response containing JSON (or maybe XML). Django makes all of this really simple.
Once you go beyond that basic set of functionality things get opinionated very quickly. There are some excellent libraries for Django that help you put together a RESTful oAuth-protected API quickly (https://github.com/toastdriven/d... for example)—but they have pretty strong opinions on how those APIs should be structured. That’s fine for a third party module, but it’s not necessarily the right thing to happen in the core framework.
Guido van Rossum once said of the Python Standard Library that once a module is added to it it already has one foot in the grave... this is very true: once something is part of Django (or Python) core development becomes MUCH more restricted... there are backwards compatibility guarantees to worry about, and a release cycle that’s much, much slower than for a standalone module.
So for something as opinionated and fast-moving as a REST API toolkit, its much better off as a third party module (like tastypie), free from the restrictions that come with being included in Django itself.
Incidentally, this logic is the main reason Django doesn’t yet ship with a built-in database migrations solution yet.
Another thing... once a solution is chosen to ship with Django, the incentive for other developers to try their own approach is reduced. Sometimes it’s better to let a bunch of solutions blossom and explore the space than to prematurely pick a “winner”.
These are just my opinions (and I’m certainly not an active Django contributor these days), but I expect you’d get a similar answer from Django’s current core developers.
More recent articles
- Prompt injection explained, November 2023 edition - 27th November 2023
- I'm on the Newsroom Robots podcast, with thoughts on the OpenAI board - 25th November 2023
- Weeknotes: DevDay, GitHub Universe, OpenAI chaos - 22nd November 2023
- Deciphering clues in a news article to understand how it was reported - 22nd November 2023
- Exploring GPTs: ChatGPT in a trench coat? - 15th November 2023
- Financial sustainability for open source projects at GitHub Universe - 10th November 2023
- ospeak: a CLI tool for speaking text in the terminal via OpenAI - 7th November 2023
- DALL-E 3, GPT4All, PMTiles, sqlite-migrate, datasette-edit-schema - 30th October 2023
- Now add a walrus: Prompt engineering in DALL-E 3 - 26th October 2023
- Execute Jina embeddings with a CLI using llm-embed-jina - 26th October 2023