Django Rest Framework - Browsable API Form always

2019-07-17 04:20发布

问题:

I'm having an issue where my api, which uses a very vanilla django-rest-framework setup (viewsets and model serializers) is working fine locally, and once deployed, works fine for everything but POSTing via the HTML form in the browsable API. Any time I submit a post via this form, I get "HTTP 400 bad request".

Has anybody experienced anything similar? I'm running NGINX/UWSGI on a centos server.

回答1:

I had the Exact same problem as you. What worked for me was downgrading Rest framework from version 3.3.0 to version 3.2.5 . I have no idea why this worked but I hope this helps you too



回答2:

This sounds like a regression. There's already a bug opened for this: https://github.com/tomchristie/django-rest-framework/issues/3588