#31870: App with default_app_config in init crashes
--------------------------------+------------------------------------------
Reporter: Iuri de Silvio | Owner: Iuri de Silvio
Type: Bug | Status: assigned
Component: Uncategorized | Version: 3.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Description changed by Iuri de Silvio:
Old description:
> If I don't have an `apps.py` and the `default_app_config` is in
> `__init__.py`, it fails.
>
> {{{
> Traceback (most recent call last):
> File "./manage.py", line 22, in <module>
> main()
> File "./manage.py", line 18, in main
> execute_from_command_line(sys.argv)
> File "django/core/management/__init__.py", line 401, in
> execute_from_command_line
> utility.execute()
> File "django/core/management/__init__.py", line 377, in execute
> django.setup()
> File "django/__init__.py", line 24, in setup
> apps.populate(settings.INSTALLED_APPS)
> File "django/apps/registry.py", line 91, in populate
> app_config = AppConfig.create(entry)
> File "django/apps/config.py", line 157, in create
> if new_entry == app_config_name:
> UnboundLocalError: local variable 'app_config_name' referenced before
> assignment
> }}}
>
> Looks like a regression added in
> https://code.djangoproject.com/ticket/31180.
New description:
If I don't have an `apps.py` and the `default_app_config` is in
`__init__.py`, it fails.
{{{
Traceback (most recent call last):
File "./manage.py", line 22, in <module>
main()
File "./manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "django/core/management/__init__.py", line 401, in
execute_from_command_line
utility.execute()
File "django/core/management/__init__.py", line 377, in execute
django.setup()
File "django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "django/apps/config.py", line 157, in create
if new_entry == app_config_name:
UnboundLocalError: local variable 'app_config_name' referenced before
assignment
}}}
If the `apps.py` is there, but the `default_app_config` is in
`__init__.py`, it fails too.
{{{
Traceback (most recent call last):
File "django/django/test/utils.py", line 381, in inner
return func(*args, **kwargs)
File "django/tests/apps/tests.py", line 541, in
test_explicit_default_app_config_with_empty_apps
with
self.settings(INSTALLED_APPS=['apps.explicit_default_config_with_empty_apps']):
File "django/django/test/utils.py", line 336, in __enter__
return self.enable()
File "django/django/test/utils.py", line 410, in enable
apps.set_installed_apps(self.options['INSTALLED_APPS'])
File "django/django/apps/registry.py", line 355, in set_installed_apps
self.populate(installed)
File "django/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "django/django/apps/config.py", line 160, in create
if new_entry == app_config_name:
UnboundLocalError: local variable 'app_config_name' referenced before
assignment
}}}
Looks like a regression added in
https://code.djangoproject.com/ticket/31180.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/31870#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.f065b856e17179fe1d6ee5dc0db7a857%40djangoproject.com.