Jump to content

[Solved] Upgrade django to python 2.7


Recommended Posts

Guest Geoff
Posted

I would like django to be upgraded to use python 2.7. (On Stevie) This can be done (supposedly) relatively easily.

 

NOTE: Please do not just copy and paste these commands. I have not verified their safeness.

 

1. Install django:

 

cd /django <-- Directory to where django installation files are located
/path/to/python2.7 ./setup.py install

 

2. Install mod_wsgi

 

cd /mod_wsgi <-- Directory to where mod_wsgi installation files are located
./configure --with-python=/path/to/python2.7
make
make install

Guest Geoff
Posted

This support request is being escalated to our root admin.

Posted

I thought djbob already did this? Isn't it something like...

 

#!/usr/bin/python3.2

 

..?

 

Although I don't know any Python myself and I have no idea if that is right. I think it's the same shebang line just with 3.2 on the end.

Guest Geoff
Posted

Djbob had upgraded the version of python. The version of python that django is running is still 2.4.

Posted

I think that makes sense. You can go ahead and run the commands. Let me know if anything breaks!

Guest Geoff
Posted

Uh... Just realized that django is not compatible with python 3.x, so I'll just upgrade it to python 2.7

 

Okay, so django installed without any errors.

 

Then, I configured the makefile with python 2.7:

 

root@stevie [/home/gfishing/mod_wsgi-3.3]# ./configure --with-python="/usr/bin/env python2.7"
checking for apxs2... no
checking for apxs... /usr/bin/apxs
checking Apache version... 2.2.16
configure: creating ./config.status
config.status: creating Makefile

 

 

Looking good so far...

root@stevie [/home/gfishing/mod_wsgi-3.3]# make
/usr/bin/apxs -c -I/usr/local/include/python2.7 -DNDEBUG   mod_wsgi.c -L/usr/local/lib -L/usr/local/lib/python2.7/config  -lpython2.7 -lpthread -ldl  -lutil -lm
/usr/local/apache/build/libtool --silent --mode=compile gcc -prefer-pic -m64 -fPIC -DPIC  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -m64 -fPIC -DPIC -pthread -I/opt/pcre/include -I/usr/local/apache/include  -I/usr/local/apache/include   -I/usr/local/apache/include  -I/usr/local/include/python2.7 -DNDEBUG  -c -o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
/usr/local/apache/build/libtool --silent --mode=link gcc -o mod_wsgi.la  -rpath /usr/local/apache/modules -module -avoid-version    mod_wsgi.lo -L/usr/local/lib -L/usr/local/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm
/usr/bin/ld: /usr/local/lib/libpython2.7.a(node.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1

 

Then it fails.

 

Okay, I've found the problem:

http://code.google.com/p/modwsgi/wiki/Inst...64_Bit_Packages

Posted

I could not find instructions on how to install Python 2.7 as a 64-bit library. I tried to recompile/altinstall Python 2.7 with --enable-shared, but I don't see a .so file in /usr/local/lib/python2.7/config/.

Guest Geoff
Posted

Now I'm getting:

 

./python2.7: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared obje

ct file: No such file or directory

 

Hmm... let me see.

 

Okay, here is the problem:

 

./python2.7: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared obje
ct file: No such file or directory

 

and here is where that file is:

 

/usr/local/lib/libpython2.7.so.1.0

 

The problem is how to make it pick that file up...

 

-------------------------------------------------------------------------------

 

 

I fixed it! Finally. (Only took a couple hours of googling around)

 

Added /usr/local/lib to ld.so.conf

 

Okay, so python2.7 is working correctly now.

 

And the new python version is loaded:

 

mod_wsgi/3.3 Python/2.7.1 Server

Posted

Cool! I thought I had added /usr/local/lib to ld.so.conf, but I guess I forgot...

Guest
This topic is now closed to further replies.
×
×
  • Create New...