On Thu, 2006-09-07 at 03:41 +0000, SmileyChris wrote:
> When moving an app to a different project, I had to go through and fix
> all the references to my project name in code. Is there a better way to
> import my code? Currently I import like:
> 
> from projectname.appname.models import Model
> 
> It seems like this inhibits portability of apps somewhat. Perhaps there
> could be some sort of "from django.conf import settings" for apps?

This is something that is already solved by Python (via the Python
import path). We don't need to add extra Django complexity here.

Drop the "projectname" part of the import and have projectname/ on your
Python path is probably the easiest here (this is essentially the same
as JPellerin's comment elsewhere in the thread about the independence of
apps and projects).

Once upon a time there was more or less a requirement to use
"projectname" in that import path to avoid some problems with related
fields (see, for example ticket #1796), but those problems have been
fixed since May or June or thereabouts, so that is not longer necessary.

Cheers,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to