Skip to content

Latest commit

 

History

History
124 lines (76 loc) · 2.96 KB

development.rst

File metadata and controls

124 lines (76 loc) · 2.96 KB

Setup development environment

Source Code

$ git clone https://github.com/release-engineering/product-definition-center.git

Installation

Option 1: Start it on RPM

For development purposes, install following dependencies:

Option 2: Start it on virtualenv

  • Install virtualenvwrapper

    $ pip install virtualenvwrapper
    

    and setup according to 'Setup' steps in /usr/bin/virtualenvwrapper.sh. Then create virtual environment

    $ mkvirtualenv pdc
    
  • Run the following

    $ workon pdc
    $ pip install -r requirements/devel.txt
    

    to activate pdc virtualenv and install all the dependencies.

Option 3: Start it on Docker

  • Install Docker: see the official installation guide for details. Generally, it might be enough to run install it with yum and then run it.

    $ sudo yum install docker-engine
    $ sudo service docker start
    
  • Use this command to build a new image

    $ sudo docker build -t <YOUR_NAME>/pdc <the directory your Dockerfile is located>
    
  • Run the container (:Z flag is required to mount volumes with SELinux)

    $ docker run -it -P -v $PWD:$PWD:Z <YOUR_NAME>/pdc python $PWD/manage.py runserver 0.0.0.0:8000
    
  • Check the address

    1. Find the address of the docker machine (127.0.0.1 --> DOCKER_HOST).

    2. Find the mapped port of your running container

      $ sudo docker ps -l --> PORT
      
  • Access it by visiting DOCKER_HOST:PORT in your web browser.

Customize settings

You can use the dist settings template by copying it to settings_local.py:

$ cp settings_local.py.dist settings_local.py

Feel free to customize your settings_local.py. Changes will be populated automatically. In local development environment, you may need to set DEBUG = True to get better error messages and comment out ALLOWED_HOSTS setting.

When you run PDC locally, you may not want to enable the permission checks, just uncomment DISABLE_RESOURCE_PERMISSION_CHECK line.

Init database

To initialize database, run:

$ python manage.py migrate --noinput

Run devel server

To run development server, run:

$ make run

For development you may find it useful to enable Django Debug Toolbar.

Related settings is documented in comment at the top of settings_local.py.dist.