Im trying to use curl to hit an endpoint in my Django application and havent been successful returning my data.
curl 127.0.0.1:8000/myapp/[email protected]&part=123434
my server shows a 301 when the curl goes through, however; none of the print statements are ran in my view, and i am not able to get the querystring parameters using request.GET.get().
[21/Aug/2018 00:26:59] "GET /myapp/[email protected] HTTP/1.1" 301 0
view.py
def index(request):
if request.method == 'GET':
print('hello world')
email = request.GET.get('email')
part = request.POST.get('part')
print(email)
print(part)
df = generate_dataframe('apps/myapp/data.csv')
df = get_dataframe_by_part(part, df)
bool = check_all(email, df)
response_data = {}
response_data['DoesUserExist'] = bool
return HttpResponse(json.dumps(response_data), content_type="application/json")
urls.py
urlpatterns = patterns('',
url(r'myapp/', include('myapp.urls')),
)
myapp/urls.py
urlpatterns = patterns('',
url(r'^$', 'myapp.views.index', name='index'),
)
The description for 301 error is
from 301 error
Hence the issue could be different. check first, whether you can able to load from chrome and the urls are correct