https://github.com/gm3dmo/cmp
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/gm3dmo/cmp
- Owner: gm3dmo
- License: gpl-3.0
- Created: 2023-09-14T11:24:16.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-28T07:32:36.000Z (over 1 year ago)
- Last Synced: 2024-05-29T05:49:48.270Z (over 1 year ago)
- Language: Python
- Size: 441 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Corps of Military Police
## Backups
A script called [db_dump_csv.py](https://github.com/gm3dmo/cmp/blob/main/scripts/db_dump_csv.py) dumps CSV files of the tables for cmp_* and uploads them to [cmp-archive](https://github.com/gm3dmo/cmp-archive) where a release is is created.
The script `db_backup_csv.sh` is called from cron each evening:
```bash
#!/bin/bash
# Path to your project
PROJECT_DIR=/home/azureuser/cmp
# Activate virtual environment
source $PROJECT_DIR/.venv/bin/activate
# Set environment variables if needed
export DJANGO_ENV=production
# Run the script
cd $PROJECT_DIR
python scripts/db_dump_csv.py
# Deactivate virtual environment
deactivate
```
Crontab entry:
```
15 18 * * * /home/azureuser/db_backup_csv.sh > /home/azureuser/logs/db_dump.log 2>&1
```
## Development Notes
For configuration [django-environ](https://github.com/joke2k/django-environ) is used.
### Countries
The countries are extracted from this article:
https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
### Test Coverage
[](https://coveralls.io/github/gm3dmo/cmp?branch=main)