Why doesn’t the Django framework come with its own REST API out of the box?
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
- Weeknotes: Parquet in Datasette Lite, various talks, more LLM hacking - 4th June 2023
- It's infuriatingly hard to understand how closed models train on their input - 4th June 2023
- ChatGPT should include inline tips - 30th May 2023
- Lawyer cites fake cases invented by ChatGPT, judge is not amused - 27th May 2023
- llm, ttok and strip-tags - CLI tools for working with ChatGPT and other LLMs - 18th May 2023
- Delimiters won't save you from prompt injection - 11th May 2023
- Weeknotes: sqlite-utils 3.31, download-esm, Python in a sandbox - 10th May 2023
- Leaked Google document: "We Have No Moat, And Neither Does OpenAI" - 4th May 2023
- Midjourney 5.1 - 4th May 2023
- Prompt injection explained, with video, slides, and a transcript - 2nd May 2023