Ticket #448 (closed defect: fixed)

Opened 5 years ago

Last modified 15 months 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:

Description

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 5 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 4 years ago by paluho@…

Yes, this change fixes the problem.

Thanks!

comment:3 Changed 4 years ago by andrew

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

comment:4 Changed 15 months 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>
    execute_from_command_line(sys.argv)
  File "/Users/vlad/Library/Python/2.7/lib/python/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
    utility.execute()
  File "/Users/vlad/Library/Python/2.7/lib/python/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  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
    __import__(name)
  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,
Vlad

comment:5 Changed 15 months 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 15 months ago by vlad.dragos.002@…

Hello,

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

Thank you for the quick reply.
Vlad

Note: See TracTickets for help on using tickets.