-
-
Notifications
You must be signed in to change notification settings - Fork 333
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
Could not import (fastapi.)HTTPException but starlette OK #4
Comments
Same for me. When running
To get around this I am importing directly from Starlette as @JSchoreels mentions above. Workaroundinstead of:
use:
|
Thanks for the report guys. It should be fixed now. DetailsThe problem was that this image had an older version of FastAPI installed. A version from before FastAPI had its own But the root problem is that when I released a new version of FastAPI, this image was not updated automatically. But I fixed it here: fastapi/fastapi#65 Now, when there's a new version of FastAPI, a build of this image will be triggered automatically, so it will always be fresh. Please try a recent version with: docker pull tiangolo/uvicorn-gunicorn-fastapi:python3.7-alpine3.8 and docker pull tiangolo/uvicorn-gunicorn-fastapi:python3.7 and let me know if it's working for you.
|
Perfect, thanks @tiangolo For what it’s worth I decided it was probably better practice to use the Docker image that this image is based on and install FastAPI and any dependencies from a requirements.txt in one fell swoop! Good to know that this image should always be running the latest release from now on though 👌 Oh and thanks for all your hard work. I’ve only been playing with FastAPI for a short while but from what I’ve seen of it so far it’s great! Excited to use it in a project in the near future |
I agree! In fact, I do that in the project generators: https://github.com/tiangolo/full-stack-fastapi-postgresql
👌 ✔️
That's great to hear! 🎉 😄 |
Thank you for the feedback @tiangolo ! Closing the issue |
Thanks for reporting back and closing the issue 👍 |
Hi tiangolo.
Thank you for your docker images
However, with this one "FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7-alpine3.8"
I had to import HTTPException from starlette because it wasn't known in fastapi, in my import.
fixed for me but I thought it would be interesting for you to know
The text was updated successfully, but these errors were encountered: