skip to Main Content

How to add CORS headers to a Django view for use with a Cordova app

Suppose you want to access some JSON data from a mobile app using Cordova. You have to bypass CORS restrictions in the web view, and to do that you have to provide some HTTP headers in your Django views.

You can do this pretty easily by using this mixin in your Class Based Views:

Use it like in the example (here used together with Django Braces app).


Freelance developer and sysadmin

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top