I prefer to to just put the apps in the project's folder and put *that*
folder on the PYTHONPATH then move it elsewhere only when I find out I
actually need it elsewhere. To make it more portable, I find out where my
project is in my filesystem at runtime so if I move it around, it's no
problem.

So, I put this code into the __init__.py of my project's folder:

from os.path import dirname
from sys import path

path.append(dirname(__file__))


sys.path is a list that holds everything that is in your PYTHONPATH
__file__ is a magic variable that holds where the file that's currently
running is in the filesystem
and os.path.dirname extract the directory name in an OS independant way.

You can of course add any folder you want in your PYTHONPATH this way, not
just the project's folder as I do.

On Tue, Dec 2, 2008 at 6:07 PM, Opel <[EMAIL PROTECTED]> wrote:

>
> I have been following along to the excellent James Bennet Book,
> Practical Django Projects and he suggests creating apps in a directory
> that can be reusable for local development.
>
> I am working on OSX (tiger and Leopard on different machines) and I
> have created a Django director inside my /User/Sites folder. Al m
> django projects will be developed here and as per James suggestion I
> was going to create and "Apps" sub directory i.e /Users/Sites/Django/
> Apps/
>
> I have searched the web and even tried to use the pylink tool but I
> cannot get my Python path to recognise this new "Apps" folder.
> Whenever I try to include an app in my INSTALLED_APPS I get "module
> not found error"
>
> Could anyone please help out or post a link to a tutorial please.
>
> Thanks
>
> >
>

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

Reply via email to