idlesign / django-siteprefs

Reusable app for Django introducing site preferences system
https://github.com/idlesign/django-siteprefs
BSD 3-Clause "New" or "Revised" License
17 stars 6 forks source link

toolbox: Delay import of Preference model #24

Open jayvdb opened 4 years ago

jayvdb commented 4 years ago

Early import of Preference causes AppRegistryNotReady

Related to https://github.com/idlesign/django-siteprefs/issues/15

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.01%) to 95.902% when pulling f34e67b5bf34d3030f020868ec11a47b97dce6f2 on jayvdb:delay-model-import into 9cb3026b94a98299d60ccb61baf567b3d0c64a2f on idlesign:master.

jayvdb commented 4 years ago

The 'cause' for this was the 'need' to import the toolbox into <project>/settings.py, which is very early in the Django startup. That could be avoided in other ways.

However, I think it is still useful for the toolbox to be available very early in the Django startup, even if not everything in the toolbox will work, and especially if it isnt wise to use everything in the toolbox at that stage. It is a toolbox full of goodies, and the engineer should be careful with these tools.