“No 'Access-Control-Allow-Origin' header is present on the requested resource” in django

前端 未结 11 705
隐瞒了意图╮
隐瞒了意图╮ 2020-12-02 16:44

I am newbie to django and using it as back end for an application that creates users. In front end the code for posting the user name is :

var xobj = new XM         


        
11条回答
  •  Happy的楠姐
    2020-12-02 17:20

    Your front and back end are on different ports which means your ajax requests are subject to cross origin security.

    You need to set up the back end to accept requests from different origins (or just different port numbers).

    Try reading up on CORS and more specifically looking at django cors headers

提交回复
热议问题