Open debkantap opened 11 months ago
When you run the application in your workspace, you should see a toast notification in the lower right corner of the window prompting you to forward the port to make it accessible from outside of your workspace:
Clicking "yes" on this dialog will allow you to open the running application in a new tab within your browser.
Some other things worth noting:
targetPort
in your endpoint with 8000
(optionally, update the name of the endpoint as well)uvicorn main:app --reload --host 0.0.0.0
. The reason this is required is that 127.0.0.1 is localhost within the container, and so not accessible from outside that container.Issues go stale after 180
days of inactivity. lifecycle/stale
issues rot after an additional 7
days of inactivity and eventually close.
Mark the issue as fresh with /remove-lifecycle stale
in a new comment.
If this issue is safe to close now please do so.
Moderators: Add lifecycle/frozen
label to avoid stale mode.
Summary
I using supplied python workspace ("python Hello world") and trying to create hello world application. Here is my code: pip install "fastapi[all]" Python Code : from fastapi import FastAPI app = FastAPI() @app.get("/") async def root(): return {"message": "Hello World"} Then run application with below command: uvicorn main:app --reload
The application is exposed to 127.0.0.0 i.e locally. I modified the devfile as below -- added the exposure directives....
container: image: quay.io/devfile/universal-developer-image:ubi8-latest endpoints:
exposure: public name: 8080-tcp protocol: http targetPort: 8080
But no luck. Any clue pls
Relevant information
No response