Hi Jeremy--

Thanks very much for the response!

On Sep 28, 5:51 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> On 9/28/07, Jason Witherspoon <[EMAIL PROTECTED]> wrote:
> ....
>
> > Okay, I'm guessing a Python reload would indeed help, as I've managed to get
> > the Python debugger to find mysite.drpack.views by forcing the paths into
> > sys.path:
>
> > >>> sys.path.append('/my/new/path')
>
> > ...rather than via the symlink method.
>
> That doesn't really make sense.   With the symlink method, can you
> import mysite?  Can you print sys.path with the symlink approach, then
> try to import, then show the path you were trying to import.
>
> Not to be rude, but is it named "mysite" or is it named "site"?
> That's a common mistake.  Django has a built-in site module which is
> responsible for setting up the python path, including site-packages.
> It sounds like this is what you're running into.
>
> To see what's going on here, try this
>
> >>> import sys
> >>> print sys.modules['site']
>
> Please report the results.

Those two lines result in:

<module 'site' from '/usr/local/lib/python2.5/site.pyc'>

These are the symlinks I've added to /usr/local/lib/python2.5/site-
packages:

lrwxrwxrwx 1 root staff     29 Sep  5 18:31 django -> /home/jason/
django_src/django/
lrwxrwxrwx 1 root staff     26 Sep 28 15:51 killdjangokill -> /home/
jason/killdjangokill/
lrwxrwxrwx 1 root staff     33 Sep 28 16:32 mysite -> /home/jason/
killdjangokill/mysite/

They don't turn up on my sys.path, though:
['', '/usr/local/lib/python2.5/site-packages/setuptools-0.6c6-
py2.5.egg', '/usr/local/lib/python2.5/site-packages/psycopg2-2.0.6-
py2.5-linux-i686.egg', '/usr/local/lib/python2.5/site-packages/
TurboGears-1.0.3.2-py2.5.egg', '/usr/local/lib/python2.5/site-packages/
SQLObject-0.9.1-py2.5.egg', '/usr/local/lib/python2.5/site-packages/
Cheetah-2.0rc8-py2.5-linux-i686.egg', '/usr/local/lib/python2.5/site-
packages/configobj-4.4.0-py2.5.egg', '/usr/local/lib/python2.5/site-
packages/DecoratorTools-1.5-py2.5.egg', '/usr/local/lib/python2.5/site-
packages/RuleDispatch-0.5a0.dev_r2306-py2.5-linux-i686.egg', '/usr/
local/lib/python2.5/site-packages/FormEncode-0.7.1-py2.5.egg', '/usr/
local/lib/python2.5/site-packages/PasteScript-1.3.5-py2.5.egg', '/usr/
local/lib/python2.5/site-packages/elementtree-1.2.7_20070827_preview-
py2.5.egg', '/usr/local/lib/python2.5/site-packages/simplejson-1.7.1-
py2.5.egg', '/usr/local/lib/python2.5/site-packages/CherryPy-2.2.1-
py2.5.egg', '/usr/local/lib/python2.5/site-packages/TurboKid-1.0.2-
py2.5.egg', '/usr/local/lib/python2.5/site-packages/TurboCheetah-0.9.5-
py2.5.egg', '/usr/local/lib/python2.5/site-packages/TurboJson-1.1-
py2.5.egg', '/usr/local/lib/python2.5/site-packages/
PyProtocols-1.0a0dev_r2302-py2.5-linux-i686.egg', '/usr/local/lib/
python2.5/site-packages/PasteDeploy-1.3.1-py2.5.egg', '/usr/local/lib/
python2.5/site-packages/Paste-1.4-py2.5.egg', '/usr/local/lib/
python2.5/site-packages/kid-0.9.6-py2.5.egg', '/usr/local/lib/
python2.5/site-packages/SQLAlchemy-0.3.10-py2.5.egg', '/usr/local/lib/
python2.5/site-packages/docutils-0.4-py2.5.egg', '/usr/local/lib/
python25.zip', '/usr/local/lib/python2.5', '/usr/local/lib/python2.5/
plat-linux2', '/usr/local/lib/python2.5/lib-tk', '/usr/local/lib/
python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages']

...so everything else in site-packages is turning up there, just not
the symlinks I've added.  For completeness sake, here's the full
listing of my site-packages directory:

www:/usr/local/lib/python2.5/site-packages# !ls
ls -lAF
total 1034
drwxr-sr-x 4 root staff   1024 Aug 30 18:16 Cheetah-2.0rc8-py2.5-linux-
i686.egg/
drwxr-sr-x 4 root staff   1024 Aug 30 18:16 CherryPy-2.2.1-py2.5.egg/
-rw-r--r-- 1 root root   24871 Aug 30 18:16 DecoratorTools-1.5-
py2.5.egg
-rw-r--r-- 1 root staff    321 Aug 20 20:07 Django-0.96_None-py2.5.egg-
info
drwxr-sr-x 4 root staff   1024 Aug 30 18:16 FormEncode-0.7.1-
py2.5.egg/
drwxr-sr-x 4 root staff   1024 Aug 30 18:16 Paste-1.4-py2.5.egg/
drwxr-sr-x 4 root staff   1024 Aug 30 18:16 PasteDeploy-1.3.1-
py2.5.egg/
drwxr-sr-x 4 root staff   1024 Aug 30 18:16 PasteScript-1.3.5-
py2.5.egg/
-rw-r--r-- 1 root root  151856 Aug 30 18:16 PyProtocols-1.0a0dev_r2302-
py2.5-linux-i686.egg
-rw-r--r-- 1 root staff    119 Aug 18 18:46 README
-rw-r--r-- 1 root root  212094 Aug 30 18:16
RuleDispatch-0.5a0.dev_r2306-py2.5-linux-i686.egg
drwxr-sr-x 4 root staff   1024 Aug 30 18:25 SQLAlchemy-0.3.10-
py2.5.egg/
drwxr-sr-x 4 root staff   1024 Aug 30 18:15 SQLObject-0.9.1-py2.5.egg/
drwxr-sr-x 4 root staff   1024 Aug 30 18:16 TurboCheetah-0.9.5-
py2.5.egg/
drwxr-sr-x 4 root staff   1024 Aug 30 18:15 TurboGears-1.0.3.2-
py2.5.egg/
drwxr-sr-x 4 root staff   1024 Aug 30 18:16 TurboJson-1.1-py2.5.egg/
drwxr-sr-x 4 root staff   1024 Aug 30 18:16 TurboKid-1.0.2-py2.5.egg/
-rw-r--r-- 1 root root   65088 Aug 30 18:16 configobj-4.4.0-py2.5.egg
lrwxrwxrwx 1 root staff     29 Sep  5 18:31 django -> /home/jason/
django_src/django/
drwxr-sr-x 4 root staff   1024 Aug 30 19:30 docutils-0.4-py2.5.egg/
-rw-r--r-- 1 root staff    885 Aug 30 19:30 easy-install.pth
-rw-r--r-- 1 root root   57415 Aug 30 18:16
elementtree-1.2.7_20070827_preview-py2.5.egg
drwxr-sr-x 4 root staff   1024 Aug 30 18:16 kid-0.9.6-py2.5.egg/
lrwxrwxrwx 1 root staff     26 Sep 28 15:51 killdjangokill -> /home/
jason/killdjangokill/
drwxr-sr-x 2 root staff   1024 Aug 18 18:54 mod_python/
-rw-r--r-- 1 root staff    254 Aug 18 18:54 mod_python-3.3.1-py2.5.egg-
info
lrwxrwxrwx 1 root staff     33 Sep 28 16:32 mysite -> /home/jason/
killdjangokill/mysite/
drwxr-sr-x 2 root staff   1024 Sep 10 19:07 psycopg2/
-rw-r--r-- 1 root root  144564 Aug 20 14:29 psycopg2-2.0.6-py2.5-linux-
i686.egg
-rw-r--r-- 1 root staff   1656 Sep 10 19:07 psycopg2-2.0.6-py2.5.egg-
info
-rw-r--r-- 1 root staff 322095 Aug 20 14:27 setuptools-0.6c6-py2.5.egg
-rw-r--r-- 1 root staff     29 Aug 20 14:27 setuptools.pth
-rw-r--r-- 1 root root   41161 Aug 30 18:16 simplejson-1.7.1-py2.5.egg


>
> >...Seems like this doesn't alter the
> > sys.path permanently, though, as the paths I append evaporate a bit later
> > when I leave IDLE & re-check sys.path....?
>
> That's certainly true.  Python has some paths that it has on the path
> by default, plus those specified in the PYTHONPATH environment
> variable, plus any paths specified in .pth files, assuming the
> standard python site module is doing its job.  Any changes you make to
> sys.path affect only the process (and forked children, I guess) in
> which you make the change.  It is, after all, just a python list.

Okay, so I want to make them persistent.  Symlinks are theoretically
the best way-- right?  But mine aren't working.  Any way to force
Python to re-check site-packages?  Any *other* ways to make the pathed
items persistent?  Be explicit, I'm otnay ootay ightbray.

>
> > NOW, the problem is I'm getting:
>
> > EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is undefined
> > (more fully:
>
> OK, this is another common mistake.  I'm guessing development, you use
> ./manage.py runserver with the default settings.py file.
>
> manage.py just assumes your settings file is somewhere on the python
> path (e.g. in the current directory, which is generally in the
> standard python path) and calls "import settings".
>
> If you want to tell django where to load your settings file, and
> you're not using manage.py, you need to set the DJANGO_SETTINGS_MODULE
> environment 
> variable.http://www.djangoproject.com/documentation/settings/#using-settings-w...

Actually, I got django running through Apache2/mod-python, so
apparently I can be handy when I'm lucky.  AND I found a workaround
online for this problem:  I put the following lines in the top of my
script & it seems to find everything perfectly through pdb:

import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

Now my problem is that I'm such a rank beginner w/Python & pdb (really
*well-documented* debugger there, incidentally</sarcasm>) that, even
though I've got all the modules needed finally loading properly, I
can't figure out how to descend into the search() function in views.py
in the debugger.  Sigh.

Anyway, I'm still slugging away, & thanks again very much for the
quick & helpful response!


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to