Hacker News new | ask | show | jobs
by Backslasher 250 days ago
Is Django's ORM even supported outside Django sites? I had a consulting gig that had a FastAPI website using Django's ORM and it produced a bunch of weird bugs.
4 comments

There's nothing forcing you to use the HTTP stack. It's very common for Django applications to also have a Celery worker for async tasks. The Celery worker is a separate process (possible on a separate host) which use the ORM without any of the HTTP portions.

You can also write custom standalone scripts which use the ORM. Django has a concept of "management scripts" which are also kinda like that (but with a bit more scaffolding).

I have made this tiny module to use it wherever I want it.

https://github.com/domingues/djangify-package

nice!
We've been running Django's orm under litestar without any issues for maybe 2 years now. We just run django's setup with a minimal settings config as a part of the app startup
> outside Django sites

What does that mean? Like you can't use the library's ORM without exposing a webserver?

More like "on a long-running process that is not a full-blown Django server"