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

Introspect AppConfig instead of requiring users to declare ARCHES_APPLICATIONS #11009

Closed
jacobtylerwalls opened this issue Jun 6, 2024 · 5 comments · Fixed by #11016
Closed
Assignees

Comments

@jacobtylerwalls
Copy link
Member

jacobtylerwalls commented Jun 6, 2024

In future work, what do you think about removing the ARCHES_APPLICATIONS setting altogether? It's occurred to me before that it's the job of the arches application, not the installer, to know whether the app is arches-related.

If the AppConfig in an arches application had is_arches_application = True, then anywhere in core that reads from that setting could just interrogate it like this (probably as a property or something):

In [1]: from django.apps import apps

In [2]: apps.get_app_config('arches_templating').is_arches_application
Out[2]: True

...and then anybody installing it doesn't have to know or care about installing it as an ARCHES_APPLICATION, it just goes into INSTALLED_APPS like every other django app and call it a day.

Originally posted by @jacobtylerwalls in #11002 (comment)

@chrabyrd
Copy link
Contributor

chrabyrd commented Jun 6, 2024

@jacobtylerwalls It looks like this may not be possible, we need this information available when settings.py is read by webpack, and there's doesn't seem to be a decent way to have the app registry load at that point

https://docs.djangoproject.com/en/5.0/ref/applications/#initialization-process

@jacobtylerwalls
Copy link
Member Author

I think we can just call django.setup(). I'm making good progress just using that.

@chrabyrd
Copy link
Contributor

chrabyrd commented Jun 7, 2024

I think we can just call django.setup(). I'm making good progress just using that.

Cool, didn't work for me but I'm interested to see what you come up with! 🤞

@jacobtylerwalls
Copy link
Member Author

Yeah you put your finger on it, the settings.py file itself is the hardest place to do this, but I have a little PoC to look at.

If we extend this with other attributes has_models = True, has_business_data = True, we won't need to send that to webpack, we won't be executing the settings.py file as a module, and we'll probably have an easier time.

jacobtylerwalls added a commit that referenced this issue Jun 7, 2024
@jacobtylerwalls jacobtylerwalls linked a pull request Jun 10, 2024 that will close this issue
11 tasks
@chrabyrd chrabyrd removed their assignment Jun 10, 2024
jacobtylerwalls added a commit that referenced this issue Jun 19, 2024
jacobtylerwalls added a commit that referenced this issue Jun 19, 2024
jacobtylerwalls added a commit that referenced this issue Jul 2, 2024
Prevents circular import error when executing settings.py as a module.
jacobtylerwalls added a commit that referenced this issue Jul 2, 2024
Prevents circular import error when executing settings.py as a module.
jacobtylerwalls added a commit that referenced this issue Jul 2, 2024
jacobtylerwalls added a commit that referenced this issue Jul 3, 2024
jacobtylerwalls added a commit that referenced this issue Jul 5, 2024
jacobtylerwalls added a commit that referenced this issue Jul 5, 2024
jacobtylerwalls added a commit that referenced this issue Jul 10, 2024
Prevents circular import error when executing settings.py as a module.
jacobtylerwalls added a commit that referenced this issue Jul 10, 2024
jacobtylerwalls added a commit that referenced this issue Jul 15, 2024
jacobtylerwalls added a commit that referenced this issue Jul 15, 2024
…ations

Declare arches applications in AppConfig #11009
@jacobtylerwalls
Copy link
Member Author

Fixed in #11016

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

Successfully merging a pull request may close this issue.

2 participants