Skip to content

Latest commit

 

History

History
57 lines (41 loc) · 1.26 KB

README.md

File metadata and controls

57 lines (41 loc) · 1.26 KB

Backend - FastAPI with PostgreSQL

This directory contains the backend of the application built with FastAPI and a PostgreSQL database.

Prerequisites

  • Python 3.8 or higher
  • Poetry (for dependency management)
  • PostgreSQL (ensure the database server is running)

Installing Poetry

To install Poetry, follow these steps:

curl -sSL https://install.python-poetry.org | python3 -

Add Poetry to your PATH (if not automatically added):

Setup Instructions

  1. Navigate to the backend directory:

    cd backend
  2. Install dependencies using Poetry:

    poetry install
  3. Set up the database with the necessary tables:

    poetry run bash ./prestart.sh
  4. Run the backend server:

    poetry run uvicorn app.main:app --reload
  5. Update configuration: Ensure you update the necessary configurations in the .env file, particularly the database configuration.

Running with Docker

Deploying the backend using Docker:

  1. Build the application image::
    sudo docker build  -t backend . 
  2. Run the container based on this image(Note: a postgres container must be running):
    sudo docker run -d -p 8000:8000 backend