python - Django SSLRedirect non-keyword arg after keyword arg -
i trying to redirect of django views https, using sslredirect middleware.
i created middleware, i'm having trouble securing specific url paths described in middleware snippet. when add {'ssl':true}
view keywords, syntax error: 'non-keyword arg after keyword arg'. urls.py is
from django.conf.urls.defaults import patterns, include, url django.views.generic.simple import direct_to_template post.views import * urlpatterns = patterns('', url(r'^$', turk_post, name='post', {'ssl':true}), )
replace:
url(r'^$', turk_post, name='post', {'ssl':true}),
with:
url(r'^$', turk_post, name='post', kwargs={'ssl':true}),
the django url
function defined this:
def url(regex, view, kwargs=none, name=none, prefix=''): # et cetera
(hence error function expects keyword argument)
Comments
Post a Comment