> EDIT: After writing all of the stuff below, I got it working, at least
> somewhat. I usually used sudo to run the dev server because I wanted
> to run it on port 80 (nevermind why, long explanation). Doing that
> still produces the same error, but if I run it without the sudo, it
> works. I have no idea why, though... Would be nice to crack that last
> nut.
>
> John: Yeah, I thought of that after writing the original post, or at
> least checking which Python interpreter gets used. Thanks for pointing
> it out though!
> The result of sys.executable is
> '/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/
> Python.app/Contents/MacOS/Python'
>
> Evert:
>> This suggests the python called by manage.py is a different one than
>> your system one. Check the first line (she-bang) of manage.py. Then
>> compare that to the output of
>> 'which python'
>> on your command line in the Terminal.
>
> The shebang says "/usr/bin/env python" in both manage.py and django-
> admin.py. Running that starts up the Apple-version of Python, i.e. the
> correct one, I think...  running sys.executable there yields the same
> results as above.

Partly my mistake: /usr/bin/python (which is the result that should be  
returned by 'which python') is a symlink to System/Library/Frameworks/ 
Python.framework/Versions/2.5/bin/python (which in turn links to  
python2.5 in the same directory).
Oddly enough, that's still different from /System/Library/Frameworks/ 
Python.framework/Versions/2.5/Resources/
> Python.app/Contents/MacOS/Python ; I don't know why Apple uses such  
> a convoluted setup.


>> If those are different, you likely installed Django with a different
>> Python before (how did you install Django, btw?). Best is to  
>> reinstall
>> python which the default Python, through 'python setup.py install'.
>> But beware: if you use the default installation (without --prefix),
>> you very likely need to specify --install-data=/Library/Python/2.5/
>> site-packages/django or something similar, since Leopard's Python
>> stores its data at another location, causing the admin part to not
>> find its css & other files.
>
> I tried reinstalling django, both with and without the --install-data
> suffix (Using '/System/Library/Frameworks/Python.framework/Versions/
> 2.5/lib/python2.5/site-packages/' as the path). I previously had
> django installed by checking out latest trunk from svn, and symlinking
> it to the site-packages folder in MacPython. I read a tip on that
> somewhere, the reason being wanting to switch between different
> revisions for different projects. I redid the symlink after upgrading
> to leopard (but to '/Library/Frameworks/Python.framework/Versions/2.5/
> lib/python2.5/site-packages/', notice the missing '/System/'), and
> since django seems to be importing correctly I guess it's working.
> (You can tell I'm pretty lost here, right? :-))

Well, I cannot blame you for being lost; it is rather a mess, with  
what Apple appears to have done.

Actually, your site-packages should go into /Library/Python/2.5/site- 
packages/
So, my advice: check if that directory is empty, and otherwise  
recursively copy (probably better not to symlink) your other site- 
packages directory (one of the above) over to there. That may actually  
result in things getting picked up by the system Python.

Although, with your traceback post below, I'm surprised it picks up  
things from /Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages

Checking my own system, I now see that I have renamed that directory  
from /Library/Frameworks/Python.frameworks to /Library/Frameworks/ 
Python.frameworks_backup , obviously because it interfered with with  
the other directories. I'm pretty sure that directory is actually a  
remnant of a MacPython installation, since you have version 2.5 in  
there (I've got 2.4), both of which weren't shipped with Tiger.

So, suggestion:
copy as described above
them rename /Library/Frameworks/Python.framework
that should get rid of old Python installation, and hopefully gets you  
running.
Do check that other python stuff you have around, continues to work.

Let me know how that worked out.

   Evert



> macbook:gantelius emilbjorklund$ sudo ./manage.py runserver 80
> Traceback (most recent call last):
>  File "./manage.py", line 11, in <module>
>    execute_manager(settings)
>  File "/Users/emilbjorklund/www/django/projects/gantelius/
> __init__.py", line 272, in execute_manager
>
>  File "/Users/emilbjorklund/www/django/projects/gantelius/
> __init__.py", line 219, in execute
>
>  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/core/management/base.py", line 72, in
> run_from_argv
>  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/core/management/base.py", line 81, in
> execute
>  File "/Users/emilbjorklund/www/django/projects/gantelius/
> __init__.py", line 73, in activate
>
>  File "/Users/emilbjorklund/www/django/projects/gantelius/
> __init__.py", line 43, in delayed_loader
>
>  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/utils/translation/trans_real.py", line
> 211, in activate
>  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/utils/translation/trans_real.py", line
> 200, in translation
>  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/utils/translation/trans_real.py", line
> 185, in _fetch
> ImportError: No module named pages
>
> If I look at the paths for the above, the python version used seems to
> be the one in '/Library/..', but the one referenced in the
> sys.executable is '/System/Library/...'. Are these different, or
> symlinked somehow...?
>
> Sorry for being such a noob, but I would really like to get a grip on
> these things, and right now it feels like I'm running around
> completely in the dark half of the time.
>
> Thanks a lot for replying, guys!
>
> //emil
> >


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