twinning project for godfathers and godsons
- Free software: GNU Affero General Public License v3.0
- Documentation: https://twinning-api.readthedocs.io.
Issues are handled in this github repository.
We're going to install and configure the latest develop build of this API.
First of all, you need to clone the project on your computer with :
git clone https://github.com/rignonnoel/twinning-api.git
You can now move in the newly created folder:
cd twinning_api
Virtualenv provides an isolated Python environment, which are more practical than installing packages system-wide. They also allow packages to be installed without administrator privileges.
- Create a new virtual environment
virtualenv env
- Activate the virtual environment
. env/bin/activate
You need to ensure the virtual environment is active each time you want to launch the project.
Requirements of the project are stored in the requirements.txt
file.
You can install them with:
WARNING : Make sure your virtual environment is active or you will install the packages system-wide.
pip install -r requirements.txt
The requirements-dev.txt
file contains packages that are only needed during
development. You should execute the previous command with this file too, unless
you are deploying in production.
Django has a system of database migration. You first need to apply all existing "migrations" to update your local database.
python manage.py migrate
Note: The project uses a squlite3 file as database to simplify developement. Once in production, feel free to switch to whatever suits you.
You can now launch an instance of the API and visit the built-in admin website.
To login into the admin page, you'll need to create a superuser first:
python manage.py createsuperuser
Launch a local API instance with:
python manage.py runserver
You can now visit these links to validate the installation:
- The root of the API: http://localhost:8000/,
- The admin site: http://localhost:8000/admin/,
- The autogenerated documentation: http://localhost:8000/docs/
A python scripts has been created to easily run all unit tests, get code coverage and validate coding style (pycodestyle). You can use it after making changes to the API:
python tests.py
This script executes the exact same thing that would be executed by the Travis CI and Coveralls.