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

Models from apps using sentry.apps entrypoint are never synced #1042

Closed
andialbrecht opened this issue Oct 21, 2013 · 1 comment
Closed

Models from apps using sentry.apps entrypoint are never synced #1042

andialbrecht opened this issue Oct 21, 2013 · 1 comment

Comments

@andialbrecht
Copy link

If an app registers itself using sentry.apps entrypoint and if the app has it's own models, the models of this app are not seen when "sentry upgrade" or "sentry start" is run. Hence there's no way to get those models into the database, except when adding the app manually to INSTALLED_APPS.

The culprit is that sentry.utils.runner:initialize_app calls skip_migration_if_applied and at some point during the initialization (or getitem) of Migrations(app_name)[name] Django populates the app cache (in django.db.models.loading). But since initialize_app is called as a callback in logan.importer.LoganLoader before the settings module is returned and properly registered in Python's import machinery all from django.conf import settings imports that happen in south will import the unmodified settings.

You can easily see what happens by adding

from django.conf import settings as django_settings
print(django_settings.INSTALLED_APPS, settings.INSTALLED_APPS)

somewhere at the top of skip_migration_if_applied (stupid prints, I know, but it illustrates the issue :) ).

As far as I understand the code the behavior that the callback function passed to LoganLoader relies on code that imports Django settings is wrong.

@dcramer
Copy link
Member

dcramer commented May 26, 2015

I believe this is now fixed (accidentally) when we added the on_configure hook.

@dcramer dcramer closed this as completed May 26, 2015
@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants