python3 ./test_uvicorn.py
INFO: Loading environment from '.env'
INFO: Started server process [279760]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: 127.0.0.1:40028 - "GET / HTTP/1.1" 200 OK
Correct Output
uvicorn test_uvicorn:app --env-file .env
INFO: Loading environment from '.env'
DEBUG: Debug Mode Enabled
INFO: Started server process [280032]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
DEBUG: DEBUG
INFO: 127.0.0.1:60288 - "GET / HTTP/1.1" 200 OK
Python, Uvicorn & OS Version
Running uvicorn 0.29.0 with CPython 3.12.2 on Linux
[!IMPORTANT]
We're using Polar.sh so you can upvote and help fund this issue.
We receive the funding once the issue is completed & confirmed by you.
Thank you in advance for helping prioritize & fund our backlog.
Initial Checks
Discussion Link
Description
When passing a
.env
file with theuvicorn.run
command it does not properly pass its information on to the uvicorn and FastAPI application.Example Code
.env file
Test Cases
Incorrect Output
Correct Output
Python, Uvicorn & OS Version