小编ohi*_*hid的帖子

即使注册成功,Django rest_auth.registration 也会发回错误

我正在制作一个使用 Vuejs 作为前端的网站。对于注册,我使用rest_auth.registration。

在 Vuejs 代码中,我通过 axios 发出注册 post 请求。

  axios.post(this.registrationUrl,{
    username,
    email,
    password1,
    password2,
  }).then(res => {
    console.log('Registration Successful!')
  }).catch(err => {
    // console.log('There is error!')
    let errData = err.response.data
    this.errors.push(errData)
     for (let errorType in errData) {
      for (let error of errData[errorType]) {
        this.errors.push(error)
      }
    } 
  })  
Run Code Online (Sandbox Code Playgroud)

问题是,在注册用户时,即使注册成功并且可以在 django 管理面板中看到新用户,代码中的 Promise 也会返回错误。

返回错误:

OSError at /rest-auth/registration/ [Errno 99] Cannot assign requested address Request Method: POST Request URL: http://localhost:8000/rest-auth/registration/ Django Version: 1.11.8 
Run Code Online (Sandbox Code Playgroud)

python authentication django rest vue.js

5
推荐指数
1
解决办法
1620
查看次数

标签 统计

authentication ×1

django ×1

python ×1

rest ×1

vue.js ×1