Ulf Kronman wrote:
> Hi Graham,
> thanks for your answer. Here some replies to your comments.
>
> > A few quick comments, although you may have so mucked up your
> > installations you might be better reinstalling everything, include the
> > OS from scratch. :-)
>
> Uh-uh. So this implies that there may be some settings tucked away in
> some place where I can't get to? But it seems as if both installation
> scripts for mod_python and psycopg2 can find and read this faulty
> setting, since they both put their packages in the funny python2.5/
> site-packages/ beneath my python2.4 path.
>
> > 1. Why are you using Apache 2.1. The Apache 2.1 stream was a
> > developmental version stream, it should not be used for production
> > use. You should use either Apache 2.0.X or Apac 2.2.X streams.
>
> Sorry for giving you the wrong Apache version. I checked with MacPorts
> and I am in fact running Apache 2.2.6 and it was this version I
> pointed at while compiling the mod_python.
>
> > 2. When building mod_python, you should use --with-python option to
> > indicate an alternate version of Python to use.
>
> Yes, I did point at my Python 2.4. Here is the config command I used:
> ./configure --with-apxs=/opt/local/apache2/bin/apxs --with-python=/
> Library/Frameworks/Python.framework/Versions/2.4/bin/python
>
> When I did my trials with Python 2.5, I also pointed at that version
> in the compilation, but still got a mod_python that said it was
> compiled for running Python 2.4 as a result.
>
> > 3. Often with MacPorts versions of Python, when building mod_python
> > you must manually edit the src/Makefile to insert additional linker
> > option into LDFLAGS to indicate where the Python framework libraries
> > are for the version of Python being used. For example, something like:
> >
> >   LDFLAGS = -Wl,-F/opt/local/Library/Frameworks ....
>
> OK, thanks. I saw a note about that somewhere, and I used it while
> trying with Python 2.5. I'll have a check if this points the wrong way
> for my Python 2.4 compilation. Right now it looks like this:
> LDFLAGS= -Wl,-framework,Python  -u _PyMac_Error $(PYTHONFRAMEWORKDIR)/
> Versions/$(VERSION)/$(PYTHONFRAMEWORK) ...
>
> Do you think I should replace the -Wl,-framework,Python part with:
> -Wl,-F/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
> site-
> packages/   ?

No, that is a different flag. It is -Wl,-f not -Wl,-F. They mean
different things. You would use:

  LDFLAGS = -Wl,-F/Library/Frameworks .....existing options

> > 4. When running Apache with that mod_python version, the PATH of the
> > user that Apache runs as must find first the version of the 'python'
> > executable you specified to the --with-python option before any other
> > versions of Python. This can be done by setting the PATH environment
> > variable appropriately in the 'envvars' file in the same directory as
> > the Apache httpd program executable.
>
> Aha. So would that be like an ordinary $PATH setting in my
> bash .profile?:
> export PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:
> ${PATH}"

Yes, but in the envvars file.

Note that this is only required because you have a secondary version
of Python installed in a non standard location. I believe if you use
dmg versions and not MacPorts it installs in standard locations and so
this isn't required.

> The thing is that I right now have a working environment, but I feel a
> bit nervous about the fact that packages install in the wrong
> directory out of my control.
>
> Sooner or later, I also have to go up to Python 2.5 for my scripting,
> since I need that version for some unicode-related hacks, due to the
> lack of unicode handling in the CSV package I use for loading my data.
> Before this havoc, I was running python 2.5 for my scripts and python
> 2.4 for the web server (without knowing it). When I install python
> 2.5, do you think I should use the MacPorts version or the DMG
> version?

Half the problem here is mod_python and the fact that it has two
parts, the Apache module and the Python modules. If the Apache module
cant find the Python modules at runtime it will not work. You might
instead consider looking at mod_wsgi instead. It is totally self
contained in the Apache module and doesn't need the separate Python
modules and therefore you cant get this specific problem. You still
have to deal with the problems related to multiple Python versions,
but this is explained in the documentation for mod_wsgi.

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

Reply via email to