Django AND.htaccess overwrite / redirect, is this possible?

Is it possible for Apache htaccess rewriting transitions to take effect before it hits django?

I want to indicate RewriteRulesin the htaccess file that takes precedence over django, and if nothing matches, then it is sent to mod_wsgi / django.

We use apache2 with mod_wsgi, and apache vhost looks like this:

<VirtualHost *:80>

    DocumentRoot /usr/local/www/site/static

    Alias /css/ /usr/local/www/site/static/css/
    Alias /js/ /usr/local/www/site/static/js/
    Alias /img/ /usr/local/www/site/static/img/
    Alias /flash/ /usr/local/www/site/static/flash/

    <Directory /usr/local/www/site/static>
      AllowOverride All
      Order allow,deny
      Allow from all
    </Directory>

    WSGIDaemonProcess mallorca-site threads=15
    WSGIScriptAlias / /usr/local/www/site/config/dev/dev.wsgi

</VirtualHost>

thank

+3
source share
3 answers

First, you are missing the WSGIProcessGroup directive. Without this, your application will not run in daemon mode, as you expect, after defining the WSGIDaemonProcess directive.

-, WSGIScriptAlias ​​ WSGIScriptAlias ​​ .htaccess , , Alias.

, AddHandler WSGI , , :

http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive

+3

Include , urls.py, .htaccess. include .htaccess, VirtualHost, , .

+1

I do not understand why you want to do this in a .htaccess file. You must do this in the virtual host configuration that you inserted above.

0
source

Source: https://habr.com/ru/post/1747392/


All Articles