No description
- HTML 64.1%
- CSS 14%
- Python 11%
- JavaScript 10.9%
| scripts/db | ||
| src | ||
| .gitignore | ||
| README.md | ||
DAI
Setting Up the Project
Get the project
- Clone the repo
git clone https://github.com/AndreFerreira5/dai
Database Setup
PostgreSQL Setup
- Install PostgreSQL: Download and install PostgreSQL from the official website.
- Open PostgreSQL: Launch the PostgreSQL application.
- Initialize PostgreSQL Database:
- Run the
create_db.sqlscript to create the database. - Run the
create_tables.sqlscript to create the necessary tables.
- Run the
MongoDB Setup
- Install MongoDB: Download and install MongoDB from the official MongoDB website.
- 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
- ie.
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
-
Navigate to the Source Directory:
- Open a terminal or command prompt.
- Change to the
srcdirectory:cd path/to/src.
-
Create a Virtual Environment:
python -m venv venv -
Activate the Virtual Environment:
- On Linux:
source venv/bin/activate - On Windows:
.\venv\Scripts\activate
- Instal the Dependencies:
pip install -r requirements.txt
Running the Project in Development Mode
- Start the Database:
- Ensure that the PostgreSQL database server is running.
- 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