Question

Django docs says:

the final dotted part of the path to the module defined in INSTALLED_APPS must be unique

I'm developing a CMS based on Django. And here comes the problem: the moment will come when two 3rd-party developers create two different apps with the same name.

Why is it so? Is there any possibility to overcome this limitation?

Was it helpful?

Solution

For the time being, the only solution is to use unique application names. This is a known limitation which is currently being worked on.

For reference, it was one of the accepted projects during the 2010 Google Summer of Code by Arthur Koziel, and you can see some of the background and design considerations on Django's 2010 GSOC wiki page.

My current understanding is that Arthur's work was largely successful, but due to concerns about making the 1.3 release a feature-light/bugfix-heavy release it was decided to delay merging the app loading refactor branch into trunk until the 1.4 development cycle.

OTHER TIPS

That is mainly because Django uses the last part as "app_label" property in some places.

For example, someModel._meta.app_label can be used in a multi-database scenario in order to decide to which database a model instance is stored. It's also used for the management commands (you must type "manage.py sqlall sites" instead of "django.contrib.sites").

How to work around this limitation? Well, I think app renaming should work if the app doesn't depend on its name in any way. But most apps actually use the app name in URLconf, for example (patterns("appname.views", ...)), so that would have to be changed, too.

But seriously, why would one install two apps with the same name? If they really have the same name, they usually have the same functionality (e.g. apps called "pagination"), so there's no need to use more than one.

the moment will come when two 3rd-party developers create two different apps with the same name.

False.

They can trivially rename their applications to be unique.

Is there any possibility to overcome this limitation?

Yes. Rename the application. It's easy. You change the package name and it's changed. How hard can that be?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top