eventsourcing-django
eventsourcing-django copied to clipboard
Django configuration docs
Since I struggled a bit with configuring persistence in Django, I was considering submitting a pull request to improve the documentation for Django integration. I found that if you create an Application object directly in a view or other file in the Django app, the migrations may not be executed yet, which can cause issues. However, I think I figured out the correct way to set it up so that these issues can be avoided.
Let me know if you want PR about this.
Hey @zgelp! Thanks for raising the issue. Yes it would be great to see what you're thinking about this. Please do submit a PR. I'm looking forward to talking about this with you.
@bibz might also be interested in this :)
Hey @johnbywater , I opened a #17 , I don't know if this is the proper and "Django" way of solving it, but it works on the CI/CD gitlab pipeline and test pass. Feel free to improve or comment how to improve it, if there's any.
Thank you very much! I am away at the moment but will definitely get back about this soon. Django is being used on one project I am currently involved in, so I will also share what you have done there. Maybe @bibz has some thoughts about this too.
Hey @zgelp,
We evolved from a home-grown message driven system to using eventsourcing and so we did things a bit differently.
In short the initiation was tied to the WSGI configuration wsgi.py
, with a manual instantiation needed for tests or in Django commands.
Could you not use the approach we use in the test suite here?
It's basically what you did in your PR but without calling migrate
in app_ready
. I fear that is not a Django best practice at all since running migrations should be a manual operation at the user's discretion.
Did you maybe forget to depend on ("eventsourcing_django, "0001_initial")
in your Django app migration?
(That is clearly a detail we could add to the documentation.)