File "/home/pelu/Projects/PythonFlask/src/app.py", line 103, in @cross_origin() NameError: name 'cross_origin' is not defined
I'm getting this same error, did you find any solution?
No yet, if you found any solution please contact me, wasosky313@gmail.com
you need to import it first
"from flask_cors import cross_origin"
I had the same issue. I ended up using the code from the flask cors documentation:
from flask import Flask from flask_cors import CORS
app = Flask(name) CORS(app)
@app.route("/") def helloWorld(): return "Hello, cross-origin-world!"
from flask import cross_origin
@cross_origin() @app.route('/') def index (); return 'Cors enabled'
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
File "/home/pelu/Projects/PythonFlask/src/app.py", line 103, in
@cross_origin()
NameError: name 'cross_origin' is not defined
I'm getting this same error, did you find any solution?
No yet, if you found any solution please contact me, wasosky313@gmail.com
you need to import it first
"from flask_cors import cross_origin"
I had the same issue. I ended up using the code from the flask cors documentation:
from flask import Flask
from flask_cors import CORS
app = Flask(name)
CORS(app)
@app.route("/")
def helloWorld():
return "Hello, cross-origin-world!"
from flask import cross_origin
@cross_origin()
@app.route('/')
def index ();
return 'Cors enabled'