Getting Started

Accessing Git Repo

You can set up the frontend to either work with an offline report, a local backend server or connect it to either the live development or production servers.

  1. Request read/write access to the git repo

  2. Activate your ssh key in putty’s pageant

  3. Clone the portal git repo in a directory of your choice

  4. Check out the development branch

    git clone -b development git@bitbucket.org:dectech/football-portal.git
    git checkout development
    

Local Frontend

You can set up the frontend to either work with a local backend server or connect to either the live development or production servers.

  1. Navigate to PlayerPortal/code/frontend in the shell or command prompt

  2. Create a file called env_config.js with the following code

    // Possible API Endpoints to call
    const SERVER_ENDPOINT = {
         OFFLINE : 'http://localhost:8080/services/offline_responses/',
         LOCAL : 'http://localhost:8000/',
         DEV: 'http://dev.api.dectechsports.com/',
         PROD : 'https://api.dectechsports.com/'
     };
    
     const BASE_URL = SERVER_ENDPOINT.DEV;
     const ACCESS_OFFLINE = false;
    
  3. Save env_config.js

  4. Run a HTTP Server in the directory. If you have python installed, you can do the following:

    python -m SimpleHTTPServer 8080
    
  5. In your browser, go to http://localhost:8080

Local Backend

  1. Navigate to Portal/code/backend

  2. Install virtualenvwrapper, follow instructions from http://virtualenvwrapper.readthedocs.io/en/latest/

    pip install virtualenvwrapper
    
  3. Create a new virtual environment and then activate it

    mkvirtualenv local_env
    workon local_env
    
  4. Install python dependecies

    pip install -r requirements.txt
    
  5. Set up SSH tunnel to Football database

  6. Create the following secrets.json file on in PlayerPortal/code/backend. Modify it accordingly based on your own DB connection settings.

    {
       "DATABASES" : {
         "default": {
           "NAME": "dectecho_portal_dev",
           "HOST": "localhost",
           "PORT": <PORT>,
           "ENGINE": "django.db.backends.mysql",
           "USER": "django-admin",
           "PASSWORD": <PASSWORD>
         },
          "player-admin": {
           "NAME": "dectecho_playeranalysis",
           "HOST": "localhost",
           "PORT": <PORT>,
           "ENGINE": "django.db.backends.mysql",
           "USER": "player-admin",
           "PASSWORD": <PASSWORD>
         }
       },
      "SECRET_KEY" : <SECRET_KEY>,
      "DJANGO_SETTINGS_MODULE" : "fb_api.settings.development",
      "CELERY_REPORTS_QUEUE_NAME": "dev-reports",
      "CELERY_DELAYABLE_QUEUE_NAME": "dev-reports-delayed",
      "CELERY_TASK_BROKER": "pyamqp://guest@localhost//",
      "CELERY_RESULTS_BACKEND": "redis://localhost:6379/0",
      "SENDGRID_API_KEY": <SENDGRID_TOKEN>,
      "FRONTEND_DOMAIN": "http://dev.analysis.dectechsports.com",
      "BACKEND_DOMAIN": "http://dev.api.dectechsports.com"
     }
    
  7. Start backend server on port 8000

    python manage.py runserver 8000
    

Connecting Both Together

  1. Start backend server on port 8000

    python manage.py runserver 8000
    
  2. Change the settings in playerportal/code/frontend/env_config.js file to the following:

    // Possible API Endpoints to call
    const SERVER_ENDPOINT = {
          OFFLINE : 'http://localhost:8080/services/offline_responses/',
          LOCAL : 'http://localhost:8000/',
          DEV: 'http://dev.api.dectechsports.com/',
          PROD : 'https://api.dectechsports.com/'
    };
    const BASE_URL = SERVER_ENDPOINT.LOCAL;
    const ACCESS_OFFLINE = false;
    
  3. Run a HTTP Server in the directory. If you have python installed, you can do the following:

    python -m SimpleHTTPServer 8080
    
  4. In your browser, go to http://localhost:8080

Virtual Machine

There is a linux machine all ready to go on the internal server, just download virtual box and load the following image: \192.168.0.10Shared FoldersITSharePortalsVirtual MachinesDectechPortals.ova