Forums

CORS error

my javscript call from localhost : //127.0.0.0 fails on a get request for cross origin. I added below to my API hosted on pythonanywhere and installed on bash with pip3 install -U flask_cors

from flask_cors import CORS
#from zenavu_scrapers import Model

app = Flask(__name__)
CORS(app)

however, its still not able to find the module.

  1. How can I enable cors on pythonanywhere?
  2. API just returns a json back. Any changes I need to make there?
  3. on the frontend, its a javascript fetch call... any changes I need to make there?

thanks

What do you mean by "call from localhost"? Are you seeing any specific errors?