Skip to content

Development Environment Setup

Sachin Kukreja edited this page Jul 30, 2019 · 8 revisions

Getting the code

  • Clone the repository
    $ git clone https://github.com/Velle-log/hs-api

Setting Up

Use command $ docker-compose up --build -d, in case you make changes to the Dockerfile.

  • Running Commands Inside API Container
    $ docker exec -it api <any command>

Alternatively, you can run $ docker exec -it api /bin/bash to get shell access to run any number of commands in the container.
It's a good practice to run docker exec -it api <any command> to run commands inside the container.

Furthermore, make sure that your manage.py is executable.
If it isn't, change permissions:
$ docker exec -it api chmod u+x manage.py.

Read more about chmod here

  • Initialize Database
    docker exec -it api pipenv run ./manage.py migrate
    docker exec -it api pipenv run ./manage.py createsuperuser

  • Setup OAuth2 Application

    • Add Application
    • Update client_type field to public & leave other fields as they are and hit Save.

Virtual environment is managed by pipenv inside the container.
Inside the container, use $ pipenv run xyz abc to run commands under the virtual environment.

Alternatively, you can just open a new shell with virtual-environment created by running $ pipenv shell and then running $ xyz abc and other commands.

It's a good practice to use $ pipenv run xyz abc to run commands for the same reason we use sudo in linux instead of just logging in as root and executing commands. On the other hand it gives you enough time to contemplate over how bad your life has gone that you have to work on this project.

The API has been setup. Check out API Docs.

Refer to Git Workflow before making any contributions.

Clone this wiki locally