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

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -