Comments (14)
Definitely looks like something desirable, but actually I never used a WSGI server host such as Apache/mod_wsgi etc before. I simply use Connexion with gevent and packaged as Docker image.
from connexion.
Yeah this is what I ended up doing as well. So this issue isn't blocking/causing an issue, more of a "one day Connexion should probably do this" sort of thing. Maybe an enhancement instead of a bug? Some additional documentation on the matter wouldn't hurt though...
from connexion.
👍 I hope "somebody" (tm) with WSGI experience can step in here :-)
from connexion.
@iwsmith using uWSGI is actually quite easy (just needs to expose app.app as "application" for WSGI), check my example: https://github.com/hjacobs/connexion-example#using-connexion-with-a-wsgi-container
from connexion.
I will close this issue as the Flask WSGI application can readily be used in WSGI containers (see connexion-example).
from connexion.
I haven't had time/the need to look into this, but thanks for following up!
from connexion.
The following is all that's needed to get it working with wsgi
app = connexion.App(NAME)
application = app.app
from connexion.
👍
from connexion.
Has anyone looked into how this can work with gunicorn instead of uWSGI? This is quite an important tool for deploying Flask apps, so ensuring there is documentation for how to use with gunicorn might be a high priority.
from connexion.
What goes into the swagger yaml file for the module name? I can get this to work with invoking ./python.py but not with python python.py or via WSGI. I get the module object has no attribute XXX
from connexion.
@sellers are you using the flask / connexion swagger generator?
If so then that is because the generated __main__.py
creates the app within main()
which called within the if __name__ == "__main__"
statement and as such the app will only be created if it's executed directly. WSGI (uwsgi or gunicorn) will instead load it as a module and not execute the if
statement.
Edit (02-2018): I just realized how very over complicated above wording was. The reason it doesn't work is because app
is created as a local variable of main()
in the swagger generated code and not as a variable in the module's namespace.
In this case the solution would simply be to modify that file so the app
(and application = app.app
) is created as a variable in the module's namespace (e.g. by moving it outside of main()
).
from connexion.
@FirefoxMetzger maybe do some upstream PR for the Swagger generator template to fix the issue?
from connexion.
#392 may be of interest if someone (like me) stumbles in this discussion.
from connexion.
This looks to work now. I can successfully run:
$ gunicorn main:app
[2020-07-02 13:38:08 +0000] [144535] [INFO] Starting gunicorn 20.0.4
[2020-07-02 13:38:08 +0000] [144535] [INFO] Listening at: http://127.0.0.1:8000 (144535)
[2020-07-02 13:38:08 +0000] [144535] [INFO] Using worker: sync
[2020-07-02 13:38:08 +0000] [144537] [INFO] Booting worker with pid: 144537
Maybe ideas from the original post was implemented.
https://github.com/zalando/connexion/blob/bed4b95205205861bd6014282d0f61d50231d3ac/connexion/apps/abstract.py#L242-L249
This code from a7af62f could indicate that.
from connexion.
Related Issues (20)
- Frozen application can't run
- Maintenance release with less restrictive dependencies HOT 1
- How to add Prometheus client /metrics endpoint to Connexion 3.x AsyncApp? HOT 3
- Validation error with multipart/form-data and object type property HOT 1
- allOf doesn't work with multipart/form-data
- Arrays are parsed incorrectly with multipart/form-data HOT 1
- Release 3.0.6? HOT 4
- Add request as an optional kwarg to auth flow HOT 2
- Stream large file to AsyncApp (application/octet-stream) HOT 7
- Execution Order Issue: before_request Executing After x-apikeyInfoFunc Authentication Method HOT 1
- RoutingMiddleware should sort paths HOT 1
- Migrating to Connexion 3: Issues with current_app and g for Authentication and Request Lifecycle HOT 4
- g object is not accessible in x-bearerInfoFunc HOT 1
- Import issues when using editable install HOT 1
- Treats trailing slashes differently for swagger and normal endpoints HOT 2
- Missing API documentation HOT 2
- Document that ConnexionMiddleware might require to specifiy routes explicitly HOT 2
- Question: Using `validate_responses=True` in connexion 3.* HOT 1
- All defaults from all OneOf schema options get propagated using the DefaultJSONValidator
- swagger-ui not resolving external references
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from connexion.