Posts Tagged ‘Django’

We’re probably not the only company switching to Python 2.7. Right now, we’re in the final phase of rolling out an updated version that uses Python 2.7. As I was setting up our servers, I ran into a few issues with packages who were hardcoded to use Python 2.6 or earlier.

Both Chronicle and YippieMove are using Django, and use on Apache with mod_wsgi. When building these two packages, we found out that were both hardcoded to use Python 2.6 or earlier. Fortunately, there’s a simple solution for it.

The first package is ‘dev/apr1′, one of Apache’s dependencies. To resolve this issue, simply edit ‘/usr/ports/dev/apr1/Makefile’. Find the line that says:

USE_PYTHON_BUILD= -2.6

and replace it with:

USE_PYTHON_BUILD= -2.7

The second application is mod_wsgi (www/mod_wsgi) itself. To resolve this edit ‘/usr/ports/www/mod_wsgi/Makefile‘ and change the line:

USE_PYTHON= 2.4-2.6

to

USE_PYTHON= 2.4-2.7

Both packages will compile just fine with Python 2.7, so no worries. I have notified both maintainers, but in the meantime, the above fix should do. Also, don’t forget to run ‘make clean’ before you try to rebuild the packages. Just for the record, we’re running FreeBSD 8.1 (AMD64), but that shouldn’t matter for the issue above.

While upgrading to Python 2.7 on one of our development servers (FreeBSD 7.2), I ran across a somewhat strange error with Django (or rather mod_wsgi). Since I didn’t find a whole lot useful results when I Googled for it, I decided to do a brief write-up about it.

The error I received was as follows:

[Errno 13] Permission denied: ‘/nonexistent’

As it turns out ‘/nonexisten’ is the home-directory for ‘www’ on FreeBSD. This is good, as you want your webserver to have as little write-access as possible. The problem is that Python uses something called Egg-files for its modules. These can be either stored extracted or compressed. The compressed ones are basically just a zip-file with the .egg-extension. The above error originates from when mod_wsgi tries to extract one of these .egg-files in the home-directory. Since ‘/nonexistant’ is non-existing folder (shocking, right?), it fails.
more>>