This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Python django cors
Type: Stage: resolved
Components: Versions:
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Anel Hodzic, ammar2
Priority: normal Keywords:

Created on 2018-09-30 14:50 by Anel Hodzic, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg326726 - (view) Author: Anel Hodzic (Anel Hodzic) Date: 2018-09-30 14:50
API call gives the desired response when trying through browser or postman. 

from rest_framework import generics
from django.shortcuts import get_object_or_404
from .jsonserializer import GroupSerializer, SubgroupSerializer, ProductsSerializer
from .models import pGroups, pSubgroups, Products
from flask import Flask
from flask_cors import CORS

app = Flask(__name__)

# @cross_origin()

# Create your views here.

class GroupList(generics.ListCreateAPIView):
    queryset = pGroups.objects.all()
    serializer_class = GroupSerializer

But when i try to make that call using JQuery

let dropdown = $('#locality-dropdown');


dropdown.append('<option selected="true" disabled>Choose product group</option>');
dropdown.prop('selectedIndex', 0);

const url = '';

// Populate dropdown with list of provinces
$.getJSON(url, function (data) {
  $.each(data, function (key, entry) {
    dropdown.append($('<option></option>').attr('value', entry.abbreviation).text(;

I get the output :

Failed to load No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

Trying to set up the FLASK-CORS

Im complete beginner in web programming
msg326728 - (view) Author: Ammar Askar (ammar2) * (Python committer) Date: 2018-09-30 14:54
Hey Anel, this bug tracker is for issues with the Python language itself, not its libraries or usage.

Try the flask-cors issue tracker or stackoverflow for more help-oriented questions:
Date User Action Args
2022-04-11 14:59:06adminsetgithub: 79034
2018-09-30 14:54:02ammar2setstatus: open -> closed

nosy: + ammar2
messages: + msg326728

resolution: not a bug
stage: resolved
2018-09-30 14:50:10Anel Hodziccreate