gothinkster / django-realworld-example-app

1.61k stars 637 forks source link

CORS issues #9

Closed dparizek closed 7 years ago

dparizek commented 7 years ago

Anyone else having trouble with CORS issues?

I get this when trying to access the django api on localhost:5000 from angular4 localhost:4200...

XMLHttpRequest cannot load http://localhost:8000/api/articles?limit=10&offset=0. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access.

dparizek commented 7 years ago

ah, in the settings.py file, there is this that needs to be adjusted...

CORS_ORIGIN_WHITELIST = (
    '0.0.0.0:4200',
    'localhost:4200',
)