[Answer]-Django Urls regex to suport old php pages

0👍

The right way to do what I was trying to do is don’t handle the querystring with the URL dispatcher. Instead of, I’ve done this:

url(r'^detalhes\.php/$', 'core.views.anuncio_antigo',name='anuncio-antigo'),

Any of those php files now will call my anuncio_antigo view. Then in view I handled the querystring using request.GET, like this:

tipo = request.GET.get('tipo')
residuo_id = request.GET.get('residuo_id')

I think it’s not possible to have a question mark in a url.

1👍

The solution that worked for me in the same situation was to configure the web server to route requests on different engines. Config we used with nginx was something like this:

location ~ ^/(django\/adm|someurl|)/.*$ {
    uwsgi_pass unix:/var/www/path/to/uwsgi.sock;
    include uwsgi_params;
    }

location ~ ^/(_.*\.php)$ {
    fastcgi_pass   php_fastcgi;
    fastcgi_param SCRIPT_FILENAME /var/www/path/to/index/php/$1;
    fastcgi_param DOCUMENT_ROOT /var/www/path/to/index/php/$1;
    include fastcgi_params;
}
👤singer

Leave a comment