Category : fastapi

I am working through the Testdriven.io: Test-Driven Development with FastAPI and Docker course and am currently on the continuous integration section. In this section you use github actions to build your docker image and run tests and linting and what not. During the Test Docker Image step of the flow I am receiving the following ..

Read more

I’ve been following along with the testdriven.io tutorial for setting up a FastAPI with Docker. The first test I’ve written using PyTest errored out with the following message: TypeError: Settings(environment=’dev’, testing=True, database_url=AnyUrl(‘postgres://postgres:[email protected]:5432/web_test’, scheme=’postgres’, user=’*****’, password=’*****’, host=’web-db’,host_type=’int_domain’, port=’5432′, path=’/web_test’)) is not a callable object. Looking at the picture, you’ll notice that the Settings object has a ..

Read more

I am creating a FastAPI server with simple CRUD functionalities with Postgresql as database. Everything works well in my local environment. However, when I tried to make it run in containers using docker-compose up, it failed. I was getting this error: rest_api_1 | File "/usr/local/lib/python3.8/site-packages/psycopg2/__init__.py", line 122, in connect rest_api_1 | conn = _connect(dsn, connection_factory=connection_factory, ..

Read more

I’m using Traefik with a few FastAPI Docker containers (not using swarm). Everything is working perfectly except my Jinja2 templates are rendering http prefixes when I make references like {{ url_for(‘assets’, path=’css/styles.css’) }} and {{request.url}}. From what I’ve read, this means that I need to force-set X-Forwards*. I can’t seem to find any documentation about ..

Read more