A Django Rest Framework API for the Axelrod-Python library
Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
api
.editorconfig
.gitignore
.travis.yml
Dockerfile
Procfile
README.rst
docker-compose.yml
manage.py
requirements.txt
run_server.py

README.rst

Axelrod API

A RESTful API for the Axelrod-Python library using Django and the Django Rest Framework.

Getting Started

First create a .env file in the root directory that contains necessary environment variables:

# python/django
PYTHONUNBUFFERED=1
DJANGO_SETTINGS_MODULE=api.config.settings
SECRET_KEY=**Django Secret Key**
DEBUG=True

# database
DATABASE_URL=postgres://postgres@db/postgres

To run this project, you will need to install Docker on your machine. Once Docker is installed and running and your .env file is defined, enter the following command from within the project folder to start the web and database servers:

docker volume create --name=postgres
docker-compose up

This will take several minutes the first time you run it as it needs to download and install all the necessary components into a docker container.

If successful, you should see the following messages at the end of the installation and configuration:

web_1  | Django version 1.11, using settings 'api.config.settings'
web_1  | Starting development server at http://0.0.0.0:8000/
web_1  | Quit the server with CONTROL-C.

and you can view the browseable API in your browser at http://localhost:8000

On OS X, you may need to use the IP address of your docker virtual machine rather then 'localhost' To find that address, use the following command:

docker-machine ip default

If you installed the Kitematic tool, you should also see your new containers in its list and you can start and stop them from there rather than the command line from now on.

Running Tests

python manage.py test --settings=api.config.test_settings

With coverage:

coverage run --source='api' manage.py test --settings=api.config.test_settings
coverage html --omit="*/test*"