5

I am making a website where I am using Vuejs for front end. For registration, I am using rest_auth.registration.

In Vuejs code, I am making the registration post request through axios.

  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)
      }
    } 
  })  

The problem is that while registering a user, the promise in the code returns an error even if the registration is successful and a new user can be seen in the django admin panel.

The returning error:

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 
4
  • you have to send JSON data in request body i.e {key: 'value'}. comma separated values won't work. Also make sure your sever is running.
    – Satendra
    Dec 14, 2017 at 5:18
  • @Satendra This is ES6 code. ES6 has this new shorthand feature. Find more at benmvp.com/learning-es6-enhanced-object-literals .
    – ohid
    Dec 14, 2017 at 5:26
  • I'm having the same issue. Did you figure it out? Mar 25, 2018 at 10:37
  • @MarcusLind unfortunately, this problem wasn't solved for me.
    – ohid
    Mar 25, 2018 at 15:42

2 Answers 2

4

For registration, rest_auth uses django_allauth. One of django_allauth's default settings is ACCOUNT_EMAIL_VERIFICATION (=”optional”). With it set to 'optional', it still tries to send out an email verification. So, you need to either:

  1. Setup an email backend (per the other answer)

OR

  1. Add ACCOUNT_EMAIL_VERIFICATION = 'none' in your settings.py
3

I was able to solve this issue by setting EMAIL_BACKEND and EMAIL_FILE_PATH (If applicable, depends on which backend you choose) in my Django settings.

It seems like the error happens when it tries to send the confirmation email on registration.

So in my case for local development:

EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
EMAIL_FILE_PATH = os.path.join(BASE_DIR, 'tmp/email')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.