#25246: Python 3 error in runserver when a directory is missing __init__.py
-------------------------------+------------------------------------
Reporter: jessamynsmith | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by carljm):
* needs_better_patch: => 0
* component: Uncategorized => Core (Other)
* needs_tests: => 0
* needs_docs: => 0
* stage: Unreviewed => Accepted
Old description:
> Using Python 3.4.2
> One app directory is missing a number of files, including __init__.py
> This results in an error when trying to run any manage.py command.
> It seems odd that the app directory is showing up multiple times in the
> path, and that duplication seems to cause issues for Django.
>
> Here is an example traceback:
>
> (testenv)~/Development/testenv-dev/testenv$ python manage.py runserver
> Traceback (most recent call last):
> File "/Users/jessamyn/.virtualenvs/testenv/lib/python3.4/site-
> packages/django/apps/config.py", line 100, in create
> entry = module.default_app_config
> AttributeError: 'module' object has no attribute 'default_app_config'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "manage.py", line 10, in <module>
> execute_from_command_line(sys.argv)
> File "/Users/jessamyn/.virtualenvs/testenv/lib/python3.4/site-
> packages/django/core/management/__init__.py", line 385, in
> execute_from_command_line
> utility.execute()
> File "/Users/jessamyn/.virtualenvs/testenv/lib/python3.4/site-
> packages/django/core/management/__init__.py", line 354, in execute
> django.setup()
> File "/Users/jessamyn/.virtualenvs/testenv/lib/python3.4/site-
> packages/django/__init__.py", line 21, in setup
> apps.populate(settings.INSTALLED_APPS)
> File "/Users/jessamyn/.virtualenvs/testenv/lib/python3.4/site-
> packages/django/apps/registry.py", line 85, in populate
> app_config = AppConfig.create(entry)
> File "/Users/jessamyn/.virtualenvs/testenv/lib/python3.4/site-
> packages/django/apps/config.py", line 103, in create
> return cls(entry, module)
> File "/Users/jessamyn/.virtualenvs/testenv/lib/python3.4/site-
> packages/django/apps/config.py", line 41, in __init__
> self.path = self._path_from_module(app_module)
> File "/Users/jessamyn/.virtualenvs/testenv/lib/python3.4/site-
> packages/django/apps/config.py", line 70, in _path_from_module
> "with a 'path' class attribute." % (module, paths))
> django.core.exceptions.ImproperlyConfigured: The app module <module
> 'emptyapp' (namespace)> has multiple filesystem locations
> (['/Users/jessamyn/Development/testenv-dev/testenv/emptyapp',
> '/Users/jessamyn/Development/testenv-dev/testenv/emptyapp',
> '/Users/jessamyn/Development/testenv-dev/testenv/emptyapp']); you must
> configure this app with an AppConfig subclass with a 'path' class
> attribute.
New description:
Using Python 3.4.2
One app directory is missing a number of files, including __init__.py
This results in an error when trying to run any manage.py command.
It seems odd that the app directory is showing up multiple times in the
path, and that duplication seems to cause issues for Django.
Here is an example traceback:
{{{
(testenv)~/Development/testenv-dev/testenv$ python manage.py runserver
Traceback (most recent call last):
File "/Users/jessamyn/.virtualenvs/testenv/lib/python3.4/site-
packages/django/apps/config.py", line 100, in create
entry = module.default_app_config
AttributeError: 'module' object has no attribute 'default_app_config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/jessamyn/.virtualenvs/testenv/lib/python3.4/site-
packages/django/core/management/__init__.py", line 385, in
execute_from_command_line
utility.execute()
File "/Users/jessamyn/.virtualenvs/testenv/lib/python3.4/site-
packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/Users/jessamyn/.virtualenvs/testenv/lib/python3.4/site-
packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/jessamyn/.virtualenvs/testenv/lib/python3.4/site-
packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/Users/jessamyn/.virtualenvs/testenv/lib/python3.4/site-
packages/django/apps/config.py", line 103, in create
return cls(entry, module)
File "/Users/jessamyn/.virtualenvs/testenv/lib/python3.4/site-
packages/django/apps/config.py", line 41, in __init__
self.path = self._path_from_module(app_module)
File "/Users/jessamyn/.virtualenvs/testenv/lib/python3.4/site-
packages/django/apps/config.py", line 70, in _path_from_module
"with a 'path' class attribute." % (module, paths))
django.core.exceptions.ImproperlyConfigured: The app module <module
'emptyapp' (namespace)> has multiple filesystem locations
(['/Users/jessamyn/Development/testenv-dev/testenv/emptyapp',
'/Users/jessamyn/Development/testenv-dev/testenv/emptyapp',
'/Users/jessamyn/Development/testenv-dev/testenv/emptyapp']); you must
configure this app with an AppConfig subclass with a 'path' class
attribute.
}}}
--
--
Ticket URL: <https://code.djangoproject.com/ticket/25246#comment:1>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/071.9ac09db5b5cade5737e28912ea4e3c8d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.