-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CORS exception cause gunicorn to not find create_app method #2026
Comments
Are you saying that you'd prefer a different error message? gunicorn currently catches TIL, actually. I didn't realize gunicorn actually |
At least with how I interpreted the error message was that
that would make more sense. If CORS is in
where
I do:
I see that this name doesn't exist within |
hrm you run like looks weird. gunicorn should use a wsgi instance and will not use the callback normally. ie it should use the the app from flask |
@benoitc I'm not sure what you mean. Are you saying the def create_app():
CORS(app, resources={r"/*": {"origins": "*"}})
return app
app = create_app() with |
Found what appears to be a related issue: #1333 |
Yup, the code from that PR is still in place. Enabling debugging for gunicorn will print the original traceback as you requested. |
@jamadden i am reffering to this line in the docker file : |
fixed in latest master |
Hello,
I observed this issue when using the
flask-CORS
plugin. The error that shows up is:Note the
Failed to find application object 'create_app()' in 'bug'
error.create_app()
clearly exists.To reproduce the error do the following:
With the directory structure:
Dockerfile
init.py
requirements.txt
Run:
and you will see the errors I described.
If you remove the CORS line so that
__init__.py
reads:and then do another
docker build -t gunicornbug ./
The application runs fine when doing
curl localhost:5000/
I deliberately didn't include an
from flask_cors import CORS
at the top to reproduce the error. Not sure what's going on here. This is a dummy example, the project where this error occurred is more complicated so I made a simpler example for reference. Let me know if you need any more info.The text was updated successfully, but these errors were encountered: