'React app won't connect to django-rest database
I'm to update the frontend of this site https://github.com/ildebr/store-repository it has a react frontend and a Django backend, auth is made with Django-rest-framework. Originally the database was using PostgreSQL but due to some trouble with my PC, I changed it to SQLite. When I try to register I'm unable to do it, I get an error of 200. I don't know what could be causing trouble cause it should not be having trouble functioning.
When trying to register I get
Internal server error: /auth/users
I already have cors implemented and set like:
CORS_ORIGIN_WHITELIST = [
'http://localhost:3000'
]
CSRF_TRUSTED_ORIGINS = [
'http://localhost:3000',
]
CORS_ALLOWED_ORIGINS = [
'http://localhost:3000',
]
Solution 1:[1]
Are you addding localhost to your
ALLOWED_HOSTS = ['localhost', '127.0.0.1']
If yes try to add 127.0.0.1 to your
CORS_ALLOWED_ORIGINS
But I see you get an internal server error.
That means you have an error in your code. So I think you may have an error in file that is in use of auth/users. You have to debug your code.
From other site you get error 200. That means that server is working properly. But your frontend code / browser returs error (I prefer to use Google Chrome for development).
peace :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | marc_s |