Django外部库和应用程序名称冲突 [英] Django external library and app name conflict
问题描述
src
|
- apps
|
--- ** my_app **
外部库
|
__ ** my_app **
|
__some_path
|
__ new_module
Django遵循旧路径并吐出
错误:没有名为my_app.some_path.new_module的模块
因为它看起来错误的文件夹。
INSTALLED_APPS =(
...
apps.my_app
my_app.some_path.new_module
...
)
注意:INSTALLED_APPS中的应用程序顺序不会区别。从INSTALLED_APS删除apps.my_app也没有任何区别。
当我尝试输入
import my_app
pycharm auto建议apps.my_app
有没有办法解决这个问题,而不是重命名一个应用程序?
对于即将推出的Django 1.7版本,它使用应用程序注册表。您可以为每个应用设置标签,以引用给他们用不同的名字。
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?
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.
这篇关于Django外部库和应用程序名称冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!