The settings
folder is divided into modules for better configuration management. Here are the available modules:
base.py
: Contains the base configurations of the project and is inherited by other modules.dev.py
: Contains the database configurations for the development environment.prod.py
: Contains the database configurations for the production server.
The module to use is selected based on the value of the ENV_MODE
environment variable defined in the settings/__init__.py
file. Make sure to set this variable correctly in your .env file according to your deployment environment.
The .env
file located in the settings folder contains all the global variables required for proper project configuration. Make sure to fill it correctly based on the .env.example
file in the same directory.
Before getting started, make sure you have the following installed on your machine:
- Docker
- Docker Compose
- Python 3.9
We use Docker & Docker compose to deploy the project. Make sure you have the latest versions of docker and docker-compose installed on the target machine!
-
Clone the GitHub repository:
git clone <REPOSITORY_URL>
-
Navigate to the project directory:
cd DataGuardian
-
Create a
.env
file in theDataGuardian/DataGuardian/settings
directory based on the.env.example
file. This file contains the global variables required for project configuration. Make sure to fill in the correct values. -
Build and run the Docker containers using Docker Compose:
docker-compose up -d
-
Check the logs to ensure everything is running correctly:
docker-compose logs
-
The server should be listening on port 8001.
If you want to run the project locally without Docker, follow these additional steps:
-
Ensure you have a running Postgres server running (use psql command to connect ):
CREATE USER <USERNAME> WITH PASSWORD ‘PASSWORD’;
CREATE DATABASE <DB_NAME>;
GRANT ALL PRIVILEGES ON DATABASE <DB_NAME> TO <USERNAME>;
MAC
-
Create a Python virtual environment and activate it:
python3.9 -m venv env source env/bin/activate
-
Install the dependencies:
pip install -r requirements.txt
-
Perform the database migrations:
python3 DataGuardian/manage.py makemigrations python3 DataGuardian/manage.py migrate
-
Start the development server:
python3 DataGuardian/manage.py runserver
WINDOWs
-
Create a Python virtual environment and activate it:
python -m venv env env/Scripts/activate
-
Install the dependencies:
pip install -r requirements.txt
-
Perform the database migrations:
python DataGuardian/manage.py makemigrations python DataGuardian/manage.py migrate
-
Start the development server:
python DataGuardian/manage.py runserver
The server should be accessible at http://localhost:8000.