installing psycopg2 for SQLAlchemy , postgress running in docker connection
It appears you are missing some prerequisite to build the package from source.
Flask with Postgres – Database is Crashing after few APIs call
I have created the flask app with nginx running in a docker container and
postgresql database in different container