我有一个只是部分Django驱动的网站。 我想Django部分是http:www.mydomain.com/register下的任何东西。 任何不在这个目录中的应该像往常一样由Apache服务。
我也必须在我的服务器上使用fastcgi。
我将如何设置我的.htaccess和url来获得这个工作?
你可以尝试一下:
# 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>
或者可能,
# mod_wsgi for your site's apache config: <VirtualHost *> # ... WSGIScriptAlias /register/ "/path/to/myproject.wsgi" # ... </VirtualHost>
就像是:
RewriteEngine On RewriteRule ^/(media.*)$ /$1 [QSA,L,PT] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^/register/(.*)$ /mysite.fcgi/$1 [QSA,L]