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.

> 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? :-))

> 1. The python your system should pick up is located at /usr/bin/
> python. Therefore, there is no need to set PYTHONBINPATH. You better  
> get rid off it completely. (I guess that is a result from your  
> previous MacPython binary.)

Right, makes sense, removed that.

> 2. I would advice against setting your PATH completely in  
> your .profile (overriding any default). The system will set a default  
> PATH; you should just be adding to that. Also, I would suggest to keep  
> the system PATH at the very front: the system executables should be  
> picked up first, then anything else the user installed later. So:
> export PATH=${PATH}:/usr/local/mysql/bin:${DJANGOPATH}

Check.

> 3. You can probably leave out (remove) the DJANGOPATH setting. There's  
> only one important executable there, django-admin.py, which you only  
> have to run once at the start of a new project. You can define an  
> alias for that, or run it with the full path specification. Helps to  
> keep your PATH (& general environment) clean.

Gotcha, left that in there though, for now.

> See above: the she-bang line should tell you.

Ok. So I did the stuff mentioned above, still the same "No module
named ..."-error. Below is the traceback from that:

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