Hacker News new | ask | show | jobs
by teddyh 1907 days ago
Django has a few drawbacks:

1. It’s tricky to use in non-web contexts. If you ever need something to happen as a response to an event which is not a web request, Django makes this difficult and ugly.

2. Django also more or less requires ownership of the database in order to function as intended. If you want to have your Django objects in your own database and handle schema changes centrally (to, for example, alleviate problem 1 above), you must also abstain from some of Django’s power, i.e. migrations, etc.

4 comments

For (1) The simplest is probably just running a Django management command - maybe from a cron job.

But maybe I'm misunderstanding the kind of task you have in mind?

For (2) - you seem to be saying "if you don't want Django to handle migrations then you lose the benefit of Django handling migrations" - but again I might have missed some subtlety here?

> If you ever need something to happen as a response to an event which is not a web request, Django makes this difficult and ugly.

You are a bit vague but this is where message/task queues (e.g. Celery + a broker) come into play. Celery integrates with Django quite nicely.

For 1. I have found that a custom admin command can go a long way. If you want to be more "reactive" have a look at this asgi/channels thing... That or custom pythons scripts with the caveat of pointing correctly the DJANGO_SETTINGS ... As for 2. Well... Basically every ORM no ?
I'm using nameko and Django in a project, and haven't seen any issues with nameko just calling django.setup() and then the models and managers.