Closed jonardrosas closed 9 years ago
Hi, I have a problem when using the the djangoUrl.reverse. On my nginx I rewrite the
the server name like the example below:
Nginx settings.
server { listen 8088; server_name www.example.com; location /proj1/ { root /home/username/mysite; charset utf-8; allow all; rewrite /proj1/(.*) /$1 break; include uwsgi_params; uwsgi_param SCRIPT_NAME /proj1/; uwsgi_pass 10.85.87.116:3033; }
}
url(r'^create/$', MyView.as_view(), name='bug_create'),
var app = angular.module("myApp", ['ng.django.urls']);
app.controller('sideBarMaskCtrl', function($scope, $filter, $http, djangoUrl) { console.log('sideBarMaskCtrl Data initialized...');
$scope.add_comment = function(bug_id, status) { data = { 'id': bug_id, 'status': status, } console.log(data); $http.post(djangoUrl.reverse('bug_create'), data).success( function(data) { console.log('posting data'); }).error(function(data,status) { console.log(status); }); };
});
So when i access my website it should expect like this: www.example.com/proj1/create/ But what djangular is doing is write it like this.: www.example.com/create/
The proj1 rewrite on my nginx does not appear.
Django doesn't know anything about the magic happening on your nginx proxy.
the server name like the example below:
nginx.conf
Nginx settings.
}
urls.py
angular.js
var app = angular.module("myApp", ['ng.django.urls']);
app.controller('sideBarMaskCtrl', function($scope, $filter, $http, djangoUrl) { console.log('sideBarMaskCtrl Data initialized...');
});
So when i access my website it should expect like this: www.example.com/proj1/create/ But what djangular is doing is write it like this.: www.example.com/create/
The proj1 rewrite on my nginx does not appear.