Skip to content

Instantly share code, notes, and snippets.

@ncoghlan
Created November 1, 2012 03:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ncoghlan/3991579 to your computer and use it in GitHub Desktop.
Save ncoghlan/3991579 to your computer and use it in GitHub Desktop.
Workaround github's broken comment system
Github won't let me comment on https://github.com/pculture/unisubs/commit/e41f74fa5a17573b08001cc1431b615abca930ba
so just saving this here for now.
unisubs is hitting the double import problem that is caused by Django's old default project layout and management script, which creates a broken Python import configuration. Django's default behaviour has been fixed (https://docs.djangoproject.com/en/dev/releases/1.4/#updated-default-project-layout-and-manage-py) but projects using the old layout may still see the issue.
The only reliable solution is to fix the layout to avoid the broken configuration that allows the same module to be imported under two different names. The simplest way to do this is to:
1. Remove any sys.path manipulation from manage.py
2. Ensure that manage.py is *not* inside a Python package (there should *not* be an adjacent __init__.py file)
3. Adjust imports as needed for any changed made in steps 1 and 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment