Skip to content

Instantly share code, notes, and snippets.

Manjeet Kumar mk123

Block or report user

Report or block mk123

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mk123
mk123 / cookies.md
Last active Jan 24, 2020
Angular 2 and django integration with CORS and cookies
View cookies.md

How to enable cookies when using angular 2 and django rest framework.

To enable cross origin requests i.e. requests from different servers to django rest framwework api we need to use the following library.
Django CORS
The above link will tell you about most of the configurations but misses some of them which I think are specific to angular 2.

Assuming your django server is running on localhost:8000 and angular 2 server is running on localhost:4200 (your servers might be running on different ports so set accordingly, make following changes in setting.py file of your django project.

You can’t perform that action at this time.