Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Oct 6 '09 at 3:30

This question came from our site for professional and enthusiast programmers.

2 Answers 2

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>
share|improve this answer
2  
mod_python is deprecated.mod_wsgi is the way to go –  Kristaps Mar 10 '11 at 11:29

Something like:

  RewriteEngine On
  RewriteRule ^/(media.*)$ /$1 [QSA,L,PT]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^/register/(.*)$ /mysite.fcgi/$1 [QSA,L]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.