Power Awarness Tool
- Docker and Docker Compose should be installed on your machine.
-
Clone the repository:
git clone https://github.com/akvo/partos-pat.git cd partos-pat
-
Environment Setup:
- Copy
.env.example
to.env
and change the values to suit your local environment:cp .env.example .env
- Set the desired values for the following variables:
MAILJET_APIKEY=YOUR_MAILJET_API_KEY MAILJET_SECRET=YOUR_MAILJET_SECRET WEBDOMAIN="<<full site URL (default: http://localhost:3000)>>"
- Copy
-
Build and Start the Containers:
Run the following command to build and start all services:
docker compose up -d
This will spin up the following services:
- Backend
- Frontend
- PostgreSQL Database
- PgAdmin
-
Stopping the Containers:
To stop the containers without removing them, run:
docker compose stop
To stop and remove the containers, networks, and volumes, run:
docker compose down
The backend service runs on port 8000 and handles the core application logic. Access it at http://localhost:8000.
The frontend service runs on port 3000 and provides the user interface. Access it at http://localhost:3000.
API documentation (Swagger) is hosted at http://localhost:3000/api/docs.
PgAdmin for managing your PostgreSQL database is accessible on port 5050. Access it at http://localhost:5050.
Use the following credentials to log in to PgAdmin:
- Email:
[email protected]
- Password:
password
This command allows you to export user data from the database to a CSV file. Admin users can then download this file from the Manage Users page in the admin panel.
To run the command and generate the CSV file, use the following command in the terminal:
docker compose exec backend python manage.py export_users_csv
- Command:
export_users_csv
- Functionality: Exports user data from the database into a CSV format.
- File Location: The generated CSV file is stored in the
./storage
directory, where it can be accessed via the admin dashboard under the Manage Users page.
This command allows you to create a superuser account in the PARTOS-PAT platform. A superuser has full administrative rights and can access the PARTOS-PAT admin panel to manage users and view statistics.
Run the command below in your terminal.
docker compose exec backend python manage.py createsuperuser
Follow the prompts to enter details like username, email, and password for the superuser. Once created, you can log in to the PARTOS-PAT admin interface using the credentials provided.
References: https://docs.djangoproject.com/en/1.8/intro/tutorial02/#creating-an-admin-user
-
If a service fails to start, check the logs with:
docker compose logs <service-name>
-
Common issues may include port conflicts or missing environment variables. Ensure all ports are available and all required
.env
files are present.