A platform for teaching and mentoring students in tech
- Python / Django 3.2
If not using docker, you can setup a virtual environment using the command below
python -m venv env
then activate it with
./env/Scripts/activate # windows or
source env/bin/activate # linux or mac
Run the command below
python -m pip install -r requirements/local.txt
Once the virtual environment has been activated, install the necessary requirements by using the command below
python manage.py migrate
Sometimes you may want to delete your database but don't want to lose your data. To do this, run the following script
python -Xutf8 manage.py dumpdata --natural-primary --exclude=contenttypes --exclude=auth.permission --exclude=admin.logentry --exclude=sessions.session > ../data.json
python manage.py loaddata ../data.json
- Go to the GitHub issue board (https://github.com/users/Victhereum/projects/4)
- In the
selected for development
lane, choose a ticket an assign to yourself - Move the chosen ticket to in progress
- Create a branch in your local pc but branching from the develop branch.
git checkout develop
git checkout -b EQU-1-lowercased-short-description
- Once coding is done, run
git commit -m "short description"
- run the
scripts.sh
script. - Alternatively, you can manually run the commands below
pylint $(git ls-files '*.py')
flake8
python manage.py test --keepdb -v 2
- If successful,
git push
your code to GitHub - Create a merge request using the link generated from the terminal
- Notify two colleagues to perform code reviews
- If code review is successful, merge to develop and move ticket to
closed
lane on GitHub
Pick a ticket on the GitHub repository. If you haven't cloned the repository, use the command to clone from the terminal
git clone https://github.com/Victhereum/equestlms.git
When creating a new branch, ENSURE that the branch name starts with the format SSS-<issue-no>-<short-description> e.g. EQU-1-project-setup and the main branch is from develop. use the command below when creating a new branch.
git checkout develop
git branch -b <branch name>
Before creating a pull request, run the commands and fix any warning/errors encountered
sh ./scripts.sh
git add .
git commit -m "my commit message"
git push -u origin <branch name>
Note: You will need to have isort, autopep8, black and pylint installed for this to work and you can install it using the commands below.
python -m pip install autopep8 pylint isort flake8
When creating a pull request, please select the target branch as develop
.
- After writing your code, make sure to run the
scripts.sh
file and ENSURE it passes before pushing to the git repository. Use the command below to run the test.
sh ./scripts.sh
Please run
pre-commit install
Run the following command
# stage your commits
$ git add .
# Commit
$ git commit -m "short desrciption"
# if pushing for the first time
$ git push -u origin <branchname>
# if pushing normally
$ git push
# Install make on windows
choco install make
# Linux or mac
sudo apt install make
- Export database content as json for backup purposes
make backup
- Creates a virtual environment in current working directory
make env
- Fixes your database if it gets corrupted. Creates a backup and also restore current data
make fixdb
- Displays help text on how to use the makefile
make help
- Syncs the project dependencies
make install
- Checks if code is conforming to best practices like PEP8
make lint
- Runs makemigrations and migrate commands
make migrate
- Pushes committed changes to the GitHub remote repository
make push
- Loads previously backed up data into the database
make restore
- Spawns the Django server
make server
- Runs unit test
make test
- Syncs the project dependencies
make update
- Build the image
docker compose -f local.yml build
- Spin it up
docker compose -f local.yml up