Django .htaccess

.htaccessdjangofastcgi

I have a site that is only partially Django driven. I want the Django portion to be anything under http:www.mydomain.com/register. Anything not in this directory should get served by apache as usual.

I also must use fastcgi on my server.

How would I set my .htaccess and urls to get this to work?

Best Answer

You can try something along the lines of this:

# mod_python for your site's apache config:

<VirtualHost *>
    # ...
    <Location "/register/">
        PythonHandler django.core.handlers.modpython
        PythonPath "['/your/project/path'] + sys.path"
        SetEnv PYTHON_EGG_CACHE /tmp/trac-eggs/myproject
        SetEnv DJANGO_SETTINGS_MODULE myproject.settings
        SetHandler python-program
        PythonDebug Off
        PythonAutoReload Off
    </Location>
    # ...
</VirtualHost>

Or possibly,

# mod_wsgi for your site's apache config:

<VirtualHost *>
    # ... 
    WSGIScriptAlias /register/ "/path/to/myproject.wsgi"
    # ...
</VirtualHost>