> I recently upgraded from OS X Tiger to 10.5 Leopard. I've been trying
> for the last two days to get my Django development setup working
> again. There seems to be a row of pitfalls involved in this but I
> think I've gotten at least a part of the way.

Apple did change several settings re: Python between Tiger and  
Leopard, which caught several people (including me), especially when  
they had installed another (non-system) Python on Tiger. So beware  
indeed.

> Right now, I get the "No module named ..."-error when I try to run "./
> manage.py runserver". The modules that don't get picked up are the
> ones outside of the specific project folder.

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.

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.

With your mention of django-admin.py running fine, also check the  
first line of that file.


> I'm definitely no Bash-wizard, but clearly there is some form of path-
> or pythonpath variable mismatch going on here. If I fire up the python
> interpreter and import the modules (or django for that matter) it
> works out just fine. MySQLdb works fine to import too (though it was a
> hassle to get it compiled and installed at first). "Import Image"
> works too.
>
>
> I had the MacPython 2.5 binary installed on 10.4, which I have removed
> now (hopefully completely, using a couple of online tutorials) since
> Python 2.5.1 is installed by default on 10.5. The built-in one is what
> I get when I fire up python from the terminal, and that's where it
> works to import stuff.
>
> Here's my .profile-file:
>
> DJANGOPATH=$HOME/www/django/src/django/bin
> PYTHONBINPATH=/Library/Frameworks/Python.framework/Versions/2.5/bin
> export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:
> $PYTHONBINPATH:$DJANGOPATH:$PATH
> export PYTHONPATH=$PYTHONPATH:$HOME/www/django/src:$HOME/www/django/
> projects
> export LC_CTYPE=en_US.UTF-8

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.)
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}
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.


>
> All my django projects are in www/django/projects/, relative to my
> home folder. "Django-admin.py startproject" works.
>
> Is there a way for me to know which python interpreter is used by
> manage.py? My guess is that the correct python interpreter is somehow
> not being used, since I can import the modules from the interactive
> shell without problem. Remnants of MacPython or Python2.3?

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


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