Ticket #448 (closed defect: fixed)

Opened 6 years ago

Last modified 2 years ago

south syncdb affects app_template_dirs content so template loader raises TemplateDoesNotExist for existing templates

Reported by: paluho@… Owned by: andrew
Priority: major Milestone: 0.7.1
Component: commands Version: 0.7
Keywords: Cc:


When I'm running tests for my app some of them raises TemplateDoesNotExist for existing templates. Exception is raised because app_template_dir cache (from django/template/loaders/app_directories.py line 20) is incomplete. It is filled, in my case, during fixture loading (by some render_to_string call) when settings.INSTALLED_APPS doesn't contains apps for migration (apps_migrated management/commands/syncdb.py line 39).

Maybe you should recreate this cache after migrations?

Change History

comment:1 Changed 6 years ago by andrew

  • Status changed from new to infoneeded
  • Milestone set to 0.7.1

Should be fixed with [630dd2b42e48] - please confirm.

comment:2 Changed 6 years ago by paluho@…

Yes, this change fixes the problem.


comment:3 Changed 6 years ago by andrew

  • Status changed from infoneeded to closed
  • Resolution set to fixed

comment:4 Changed 2 years ago by vlad.dragos.002@…

  • Status changed from closed to reopened
  • Resolution fixed deleted

Hello guys,

I'm having a problem with this fix :). When I run manage.py syncdb I get the following:

Traceback (most recent call last):
  File "/Users/vlad/Projects/Parcel/manage.py", line 10, in <module>
  File "/Users/vlad/Library/Python/2.7/lib/python/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
  File "/Users/vlad/Library/Python/2.7/lib/python/site-packages/django/core/management/__init__.py", line 392, in execute
  File "/Users/vlad/Library/Python/2.7/lib/python/site-packages/django/core/management/__init__.py", line 272, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/Users/vlad/Library/Python/2.7/lib/python/site-packages/django/core/management/__init__.py", line 77, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/Users/vlad/Library/Python/2.7/lib/python/site-packages/django/utils/importlib.py", line 35, in import_module
  File "/Users/vlad/Library/Python/2.7/lib/python/site-packages/South-0.8.2-py2.7.egg/south/management/commands/__init__.py", line 10, in <module>
    import django.template.loaders.app_directories
  File "/Users/vlad/Library/Python/2.7/lib/python/site-packages/django/template/loaders/app_directories.py", line 25, in <module>
    raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
django.core.exceptions.ImproperlyConfigured: ImportError core: cannot import name models

The core app is imported and used in other apps and I don't get any errors. If I disable either south or the app in which the exception is thrown everything works like a charm. I also commented the line with the fix in south/management/commands/__init__.py and it worked.

Do you have any idea on why this is happening?

Best regards,

comment:5 Changed 2 years ago by andrew

  • Status changed from reopened to closed
  • Resolution set to fixed

Hi Vlad,

The mailing list is the place to discuss issues like this, please don't reopen old tickets unless it's exactly the same bug.

I'd check for circular imports, apps that aren't actually in INSTALLED_APPS, and any runtime modification of models you're doing, if any. If none of that helps, come say hi on the mailing list and I'll try to help further.

comment:6 Changed 2 years ago by vlad.dragos.002@…


Sorry for reopening the ticket, It's my first time here :) I will join the mailing list then.

Thank you for the quick reply.

Note: See TracTickets for help on using tickets.