Skip to content
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

Mounting on a Flask App #8

Open
cthoyt opened this issue Mar 15, 2023 · 2 comments
Open

Mounting on a Flask App #8

cthoyt opened this issue Mar 15, 2023 · 2 comments

Comments

@cthoyt
Copy link
Contributor

cthoyt commented Mar 15, 2023

A web service I want to include a rdflib-endpoint instance in is built in Flask, can you add documentation on how to mount a rdflib_endpoint.SparqlEndpoint to an existing flask.Flask that doesn't require converting everything over to FastAPI?

@vemonet
Copy link
Owner

vemonet commented Mar 17, 2023

Hi @cthoyt do you have a pointer to this flask app please? To have a reference

I think this documentation is what you are searching for: https://fastapi.tiangolo.com/advanced/wsgi/

You can mount the whole flask app on the FastAPI app (in your case instantiated as SparqlEndpoint), then run everything on uvicorn

With this approach you still have your whole flask code as before, and the code to merge the flask API with the SPARQL endpoint is minimal and clear

If you prefer to really have flask at the root, it seems like flask is built on the same WSGI standard: https://flask.palletsprojects.com/en/2.2.x/deploying/gunicorn so you can probably mount the FastAPI/SparqlEndpoint app on the flask app (the same way as described in the FastAPI doc), and deploy the flask app with uvicorn/gunicorn

If you have a reference to the project I can check to see how it could be done exactly, and I'll add the process to the docs

@cthoyt
Copy link
Contributor Author

cthoyt commented Mar 18, 2023

Note that I would want to mount a fastapi app on a flask app, not the other way around

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants