python - How do I post to Django /accounts/login/ from mobile native application? -
i use django 1.6 , python2.7 , develop web application.
i post there parameters mobile native application.
csrfmiddlewaretoken username password
but, 403 forbidden happened.
could tell me how resolve it?
my urls.py is
url(r'^accounts/login/$', 'django.contrib.auth.views.login', name='login1'),
and, /registration/login.html
template has csrf_token
<body style="margin-top: 5em;"> <div class="container"> <form method="post" action=".">{% csrf_token %} <div class="modal" style="position: relative; top: auto; left: auto; margin: 0 auto; z-index:1;"> <div class="modal-header">
you can add @csrf
in views or add {% csrf_token %}
in template. , can post data.
Comments
Post a Comment