On Aug 7, 2:56 pm, Peter Herndon <tphern...@gmail.com> wrote:
> On 08/07/2009 05:33 PM, Milan Andric wrote:
>
>
>
> > Hello I have two apps that have foreign keys to each other.  Like:
>
> > people.models:
>
> >    class Profile(Model):
> >       secondary_email = CharField()
>
> >    class Staff(Profile):
> >       office = ForeignKey(Room)
>
> > resources.models:
>
> >    class Room(Model):
> >       name = CharField()
>
> >    class Reservation(Model):
> >       profile = ForeignKey(Profile)
>
> > Runserver seems to work fine but when i do ./manage.py sqlall people I
> > get a "Error: App with label people could not be found. Are you sure
> > your INSTALLED_APPS setting is correct?" error.
>
> > Is there a way around this or do I need to rip my apps apart so I can
> > foreign key to my rooms model?
>
> > Thanks,
>
> > Milan
>
> Hi Milan,
>
> It sounds like your 'people' and 'resources' packages aren't being found
> by manage.py.  That means they aren't on your PYTHONPATH.  There's a
> little bit of explanation in the first couple of paragraphs here:  
> http://docs.djangoproject.com/en/dev/ref/django-admin/
>
> Assuming that 'people' and 'resources' are both Python packages that
> started life as the result of django-admin.py startapp, then the easiest
> thing to do is to make sure both modules are accessible to Python's
> site-packages.  That way, you can use people and resources in your
> current app, and use them again later in another app without having to
> move them from their current location on the file system.
>
> There are two ways to go about this.  The first way is to (assuming you
> are running Linux or OS X) link to the package directory from within
> site-packages.  That is, "cd /usr/lib/python2.6/site-packages" and then
> "sudo ln -s /home/milan/projects/people ."  for each package.  (Needless
> to say, modify the paths to reflect your system.)  This method is quick
> and easy, but places these modules in your system's Python install.  You
> may need to be cautious in doing so, as you may run into a namespace
> clash with existing packages.
>
> The second method is to learn all about virtualenv and use that
> wonderful tool to do what it does best.  Virtualenv allows you to create
> a sandboxed Python installation per project, separate from your system's
> Python installation.  With each project in its own sandbox, you don't
> need to worry about interfering with your system, or with version
> conflicts between the needs of one project and the next.  Use virtualenv
> with pip and virtualenvwrapper to make your life even easier, as pip
> allows you to install packages to your virtualenv similar to
> easy_install.  The downside, of course, is that you have to learn a few
> more tools, and use them with discipline.  Happily, they aren't hard to
> learn and are reasonably well documented.
>
> Hope that helps,

Hi Peter,  thanks for all the helpful information but I don't think
this is an import problem because everything works fine until I add
the circular dependency/foreign key.

--
Milan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to