After reading the documentation, it seems to me that it assumes that root is on the path. I am therefore a little surprised that runserver is not working that way.
Maybe it is good to modify manage.py to include root on path so that later migration to mod_python will not cause so many problems. What do you think? On Jul 14, 10:10 am, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Jul 14, 11:42 am, Rickard <[EMAIL PROTECTED]> wrote: > > > Hi, > > > The documentation says "The value you use for PythonPath should > > include the parent directories of all the modules you are going to > > import in your application." > > > If I have a typical Django project structure: > > > root > > - mysite > > -- myapp1 > > -- myapp2 > > > I should put root on the Python PATH, right? > > Yes and if you don't always use 'mysite.' package prefix in url rules > and just say 'myapp1.', 'myapp2.' etc, then you must also put 'mysite' > into Python PATH. > > > But when using 'manage.py runserver' it puts mysite on the Python > > PATH, but it seems like 'import mysite' is still working. I am > > confused. > > The runserver stuff is a bit too magic. It puts 'root' on sys.path but > only long enough to import 'mysite' package root. It then removes it > from sys.path. As you found it also adds 'mysite' to Python PATH, > which is why when using mod_python you must add 'mysite' to Python > PATH if you have relied on ability in runserver to import applications > within site directory without using 'mysite.' package prefix. > > > Can someone help me clarify this? What should go on the Python PATH if > > using a typical Django project structure? > > On mod_python, safest is to add both, although preferable that only > 'root' be added. > > How runserver handles path in odd ways always causes problems for > people when moving to mod_python. > > Graham --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---