Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django configuration docs #16

Open
zgelp opened this issue Feb 28, 2023 · 5 comments
Open

Django configuration docs #16

zgelp opened this issue Feb 28, 2023 · 5 comments

Comments

@zgelp
Copy link
Contributor

zgelp commented Feb 28, 2023

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.

@johnbywater
Copy link
Contributor

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.

@johnbywater
Copy link
Contributor

@bibz might also be interested in this :)

@zgelp
Copy link
Contributor Author

zgelp commented Mar 15, 2023

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.

@johnbywater
Copy link
Contributor

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.

@bibz
Copy link
Contributor

bibz commented Mar 20, 2023

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants