Comments (6)
@Kludex implemented integrated support in the official Python VS Code extension: microsoft/vscode-python#14606
Meanwhile, you can try these snippets: microsoft/vscode-python#14247 (comment)
from uvicorn-gunicorn-fastapi-docker.
My workaround is to add
import uvicorn
and at the bottom of the main.py
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)
And run it as a normal python file without docker at all. In pro version of pycharm it is possible to setup docker as a remote debugger, but I don't use that feature.
from uvicorn-gunicorn-fastapi-docker.
thank you. I'll check out pycharm
from uvicorn-gunicorn-fastapi-docker.
I do all of the above but then I get the following error when hitting the endpoint.
INFO: 127.0.0.1:50311 - "GET /coordinate/2 HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/Users/sihomiri/anaconda2/envs/py37/lib/python3.7/site-packages/uvicorn/protocols/http/httptools_impl.py", line 385, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/Users/sihomiri/anaconda2/envs/py37/lib/python3.7/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in call
return await self.app(scope, receive, send)
File "/Users/sihomiri/anaconda2/envs/py37/lib/python3.7/site-packages/fastapi/applications.py", line 139, in call
await super().call(scope, receive, send)
File "/Users/sihomiri/anaconda2/envs/py37/lib/python3.7/site-packages/starlette/applications.py", line 134, in call
await self.error_middleware(scope, receive, send)
File "/Users/sihomiri/anaconda2/envs/py37/lib/python3.7/site-packages/starlette/middleware/errors.py", line 178, in call
raise exc from None
File "/Users/sihomiri/anaconda2/envs/py37/lib/python3.7/site-packages/starlette/middleware/errors.py", line 156, in call
await self.app(scope, receive, _send)
File "/Users/sihomiri/anaconda2/envs/py37/lib/python3.7/site-packages/starlette/exceptions.py", line 73, in call
raise exc from None
File "/Users/sihomiri/anaconda2/envs/py37/lib/python3.7/site-packages/starlette/exceptions.py", line 62, in call
await self.app(scope, receive, sender)
File "/Users/sihomiri/anaconda2/envs/py37/lib/python3.7/site-packages/starlette/routing.py", line 590, in call
await route(scope, receive, send)
File "/Users/sihomiri/anaconda2/envs/py37/lib/python3.7/site-packages/starlette/routing.py", line 208, in call
await self.app(scope, receive, send)
File "/Users/sihomiri/anaconda2/envs/py37/lib/python3.7/site-packages/starlette/routing.py", line 41, in app
response = await func(request)
File "/Users/sihomiri/anaconda2/envs/py37/lib/python3.7/site-packages/fastapi/routing.py", line 111, in app
raw_response = await dependant.call(**values)
File "/Users/sihomiri/Documents/GPS/app.py", line 26, in get_coordinate
data = await dal.find("coordinates",{"id":id})
File "/Users/sihomiri/Documents/GPS/data_acces_layer.py", line 69, in find
for result in await cursor.to_list(length=100):
RuntimeError: Task <Task pending coro=<RequestResponseCycle.run_asgi() running at /Users/sihomiri/anaconda2/envs/py37/lib/python3.7/site-packages/uvicorn/protocols/http/httptools_impl.py:385> cb=[set.discard()]> got Future attached to a different loop
from uvicorn-gunicorn-fastapi-docker.
@geekkun that does not support auto-reload though, right?
At least I had to do something like this in a file in my root folder for reload to work as well
if __name__ == "__main__":
uvicorn.run("app.main:app", host="0.0.0.0", port=8000, reload=True)
from uvicorn-gunicorn-fastapi-docker.
Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues.
from uvicorn-gunicorn-fastapi-docker.
Related Issues (20)
- Application does not start up when combining this image and a database connection in Linux CentOS. HOT 4
- Upgrade from python3.8 to python3.11 fails HOT 1
- ModuleNotFoundError: No module named 'app' HOT 2
- APScheduler logs not showing in docker HOT 1
- websocket can not use
- Deploying HuggingFace model/pipeline using uvicorn-gunicorn-fastapi-docker on Google Cloud Run HOT 2
- Is --proxy-headers applied in the uvicorn CMD in the image? HOT 1
- getting timeout 504 in 1 minute
- Support for Apple sillicon
- New docker-image may be broken HOT 1
- apt-get update not working on specific version
- container build fails with pydantic-settings HOT 1
- Uvicorn -gunicorn-fastapi-docker
- Runtime Error: Can't start new thread HOT 2
- linux/arm64/v8 not supported HOT 2
- Unexpected Redirection of `/docs` Endpoint with Custom `APP_MODULE` Setup
- Current gunicorn version does not support Python 3.11 HOT 1
- Base Dockerfile HOT 3
- pydantic_settings package not supported
- Update fastapi to support Pydantic2 HOT 1
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 uvicorn-gunicorn-fastapi-docker.