Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#13512 closed (worksforme)

syncdb fails on application with no models defined

Reported by: Atr3ides Owned by: nobody
Component: Database layer (models, ORM) Version: 1.2-beta
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Karen Tracey)

Traceback (most recent call last):
  File "src/project/manage.py", line 18, in <module>
    management.execute_manager(settings)
  File "/home/user/projects/project/ve/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/home/user/projects/project/ve/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/user/projects/project/ve/lib/python2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/user/projects/project/ve/lib/python2.6/site-packages/django/core/management/base.py", line 217, in execute
    self.validate()
  File "/home/user/projects/project/ve/lib/python2.6/site-packages/django/core/management/base.py", line 245, in validate
    num_errors = get_validation_errors(s, app)
  File "/home/user/projects/project/ve/lib/python2.6/site-packages/django/core/management/validation.py", line 28, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/home/user/projects/project/ve/lib/python2.6/site-packages/django/db/models/loading.py", line 146, in get_app_errors
    self._populate()
  File "/home/user/projects/project/ve/lib/python2.6/site-packages/django/db/models/loading.py", line 61, in _populate
    self.load_app(app_name, True)
  File "/home/user/projects/project/ve/lib/python2.6/site-packages/django/db/models/loading.py", line 78, in load_app
    models = import_module('.models', app_name)
  File "/home/user/projects/project/ve/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/user/projects/project/ve/lib/python2.6/site-packages/piston/models.py", line 28, in <module>
    admin.site.register(Nonce)
  File "/home/user/projects/project/ve/lib/python2.6/site-packages/django/contrib/admin/sites.py", line 90, in register
    validate(admin_class, model)
  File "/home/user/projects/project/ve/lib/python2.6/site-packages/django/contrib/admin/validation.py", line 20, in validate
    models.get_apps()
  File "/home/user/projects/project/ve/lib/python2.6/site-packages/django/db/models/loading.py", line 115, in get_apps
    self._populate()
  File "/home/user/projects/project/ve/lib/python2.6/site-packages/django/db/models/loading.py", line 61, in _populate
    self.load_app(app_name, True)
  File "/home/user/projects/project/ve/lib/python2.6/site-packages/django/db/models/loading.py", line 83, in load_app
    if not module_has_submodule(app_module, 'models'):
  File "/home/user/projects/project/ve/lib/python2.6/site-packages/django/utils/module_loading.py", line 15, in module_has_submodule
    for entry in package.__path__:  # No __path__, then not a package.
AttributeError: 'module' object has no attribute '__path__'

Change History (3)

comment:1 by Russell Keith-Magee, 15 years ago

Resolution: worksforme
Status: newclosed

A stack trace doesn't constitute an error report. You need to tell us how to generate the error.

Working on the assumption that the problem is just 'an app without a models.py', I can't reproduce this.

comment:2 by Karen Tracey, 15 years ago

Description: modified (diff)

Sounds like (though details of the traceback have changed in the interim): http://code.djangoproject.com/ticket/11696#comment:12. Prior to the introduction of module_has_submodule, things found in INSTALLED_APPS that did not have a __path__ were just ignored. The check was originally put in for "odd things" like eggs (though it's not necessary for eggs); the original person who hit a problem which caused the check to be added actually had a completely unnecessary non-app listed in INSTALLED_APPS. If there's a valid reason for having things in INSTALLED_APPS that don't have a __path__ then we can probably deal with it in module_has_submodule, but I haven't heard that reason yet. The one person who originally ran into the issue when the __path__ check was put in acknowledged it was caused by an error in their INSTALLED_APPS.

comment:3 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top