django.root decouples URLconf from Apache conf

Maybe I didn’t read the detailed change log for Django 1.0 … in any case I missed this important new feature. If you are using Apache and mod_python to serve your Django site, you can add a directive to your Apache conf that will tell Django the root path of your Django URLs:

PythonOption django.root /apps

It seemed as though most Django examples assumed that your Django site was served from the root URL of the web server — even though that wasn’t a requirement in any way. The problem before this setting was available is that it coupled your Django project root URLconf to your web server configuration because Django always received the full URL path. Now with this setting, the root Django path from your Apache config is stripped off before matching url patterns in your Django URLconfs.

Thanks, Django!

, ,