Denis Kanygin
Denis Kanygin

Reputation: 1133

Django external library and app name conflict

Have a django app 'my_app'. Now added an external library that happens to have the same name and needs to be added to INSTALLED_APPS.

src
 |
 -- apps
      |
      --- **my_app**


external libraries
         |
          __ **my_app**
               |
                __some_path
                      |
                       __ new_module

Django follows the old path and spits out

Error: No module named my_app.some_path.new_module

because it is looking in the wrong folder.

INSTALLED_APPS = (
    ...
    apps.my_app
    my_app.some_path.new_module
    ...
)

Note: order of apps in INSTALLED_APPS makes no difference. Removing apps.my_app from INSTALLED_APS also made no difference.

When I try to type

import my_app

pycharm auto suggests apps.my_app

Is there any way to resolve this without renaming one of the apps?

Upvotes: 5

Views: 3090

Answers (1)

arocks
arocks

Reputation: 2882

Well, brace yourself for the upcoming Django 1.7 release which solves such app conflicts in an elegant manner using an "app registry". You can set a label for each app to refer to them with a different name.

Upvotes: 3

Related Questions