No description
  • HTML 64.1%
  • CSS 14%
  • Python 11%
  • JavaScript 10.9%
Find a file
2023-12-21 17:25:18 +00:00
scripts/db added db scripts 2023-12-19 19:09:46 +00:00
src updated requirements.txt 2023-12-21 17:00:43 +00:00
.gitignore updated gitignore + added tests folder 2023-12-13 03:15:05 +00:00
README.md updated README with env and mongodb info 2023-12-21 17:25:18 +00:00

DAI

Setting Up the Project

Get the project

  1. Clone the repo
git clone https://github.com/AndreFerreira5/dai

Database Setup

PostgreSQL Setup

  1. Install PostgreSQL: Download and install PostgreSQL from the official website.
  2. Open PostgreSQL: Launch the PostgreSQL application.
  3. Initialize PostgreSQL Database:
    • Run the create_db.sql script to create the database.
    • Run the create_tables.sql script to create the necessary tables.

MongoDB Setup

  1. Install MongoDB: Download and install MongoDB from the official MongoDB website.
  2. Start MongoDB Service: Ensure the MongoDB service is running on your system.
    • On Windows, MongoDB is installed as a service and starts automatically.
    • On Linux or macOS, you may need to start MongoDB manually depending on your distro.
      • ie. sudo systemctl enable --now mongodb.service

Creating Environment File

The .env file is crucial for the project to run, meaning that without it, the project won't run. You must create it and set the variables.

.env file exampe:

# Flask App Configuration
HOST=localhost
APP_PORT=5001
API_PORT=5000

# OpenAI API Key
OPENAI_API_KEY=your_openai_api_key

# Flask App Directories
APP_TEMPLATE_FOLDER=../frontend/app/templates
APP_STATIC_FOLDER=../frontend/app/static
LANDING_TEMPLATE_FOLDER=../frontend/landing/templates
LANDING_STATIC_FOLDER=../frontend/landing/static

# PostgreSQL Database Configuration
POSTGRES_DB_NAME=dai_db
POSTGRES_DB_USER=your_mongo_user
POSTGRES_DB_PASS=your_postgres_password
POSTGRES_DB_HOST=localhost

# MongoDB Configuration
MONGO_DB_NAME=dai_mongo
MONGO_DB_USER=your_mongo_user
MONGO_DB_PASS=your_mongo_password
MONGO_DB_HOST=localhost
MONGO_DB_PORT=27017

# JWT Secret Key
JWT_SECRET_KEY=your_jwt_secret_key

Installing Python Dependencies

  1. Navigate to the Source Directory:

    • Open a terminal or command prompt.
    • Change to the src directory: cd path/to/src.
  2. Create a Virtual Environment:

    python -m venv venv
    
  3. Activate the Virtual Environment:

  • On Linux:
    source venv/bin/activate
    
  • On Windows:
    .\venv\Scripts\activate
    
  1. Instal the Dependencies:
    pip install -r requirements.txt
    

Running the Project in Development Mode

  1. Start the Database:
  • Ensure that the PostgreSQL database server is running.
  1. Run the APIs:
  • Navigate to the API directory: cd src/api/
  • Run the main API:
    python api.py
    
  • In a separate terminal, run the app API:
    python app.py