Lord-Haji / QAGPT-Server-Django

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

QAGPT-Backend-Django

Overview

QAGPT-Backend-Django is a Django-based backend application, designed to provide robust and efficient backend services. This application is configured with PostgreSQL for database management and utilizes Python and Poetry for environment setup and package management.

Prerequisites

Before setting up the project, ensure you have Python and make installed on your system. This application requires Python 3.x.

Installing Make

  • Ubuntu/Debian:

    sudo apt-get install make
  • macOS:

    brew install make
  • Windows:
    Install make via Chocolatey:

    choco install make

    Install make via Scoop:

    scoop install make

Set Environment Variables

Before running the project, you need to set the following environment variables:

  • ASSEMBLYAI_API_KEY: Your AssemblyAI API key.
  • GOOGLE_API_KEY: Your GoogleGenAI API key.
  • OPENAI_API_KEY: Your OpenAI API key.

Installation

Install Poetry

Poetry is used for managing dependencies in a more efficient way. Install it using the following commands:

Note: python - is the Python binary. Change python to whatever Python is called in your system.

  • Linux/Unix:

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

    (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -

Install WeasyPrint Dependencies

WeasyPrint is used for PDF generation. Install its dependencies, GTK and Pango, as described in the WeasyPrint documentation.

Install and Setup PostgreSQL

This application uses PostgreSQL as its database. Install PostgreSQL and configure the database credentials in autoqa/settings.py.

Running the Application

Follow these steps to get the application running:

  1. Install dependencies:

    make install
  2. Activate the poetry shell:

    make shell
  3. Setup database migrations:

    make migrations
  4. Run the server:

    make run

    Optionally, you can run the server on port 8000:

    make run-exposed

Accessing the Application

  • Access the Django Admin Panel at localhost:8000/admin. If hosted, use [hostname]:[port]/admin.

  • For API documentation, visit:

    • Swagger UI: localhost/api/schema/docs or [hostname]:[port]/api/schema/docs
    • ReDoc: localhost/api/schema/redoc or [hostname]:[port]/api/schema/redoc

Code Formatting and Linting

  • Black is used as the autoformatting solution. Run it using:

    make format
  • Flake8 is used for linting. Run it using:

    make lint

TODO

Author

This project was developed by Yudhajit Sinha. For more information or inquiries, please contact yudhajitsinha@outlook.com.

About


Languages

Language:Python 90.5%Language:HTML 8.4%Language:Makefile 1.0%