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.
Request read/write access to the git repo
Activate your ssh key in putty’s pageant
Clone the portal git repo in a directory of your choice
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.
Navigate to PlayerPortal/code/frontend in the shell or command prompt
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;Save env_config.js
Run a HTTP Server in the directory. If you have python installed, you can do the following:
python -m SimpleHTTPServer 8080In your browser, go to http://localhost:8080
Local Backend¶
Navigate to Portal/code/backend
Install virtualenvwrapper, follow instructions from http://virtualenvwrapper.readthedocs.io/en/latest/
pip install virtualenvwrapperCreate a new virtual environment and then activate it
mkvirtualenv local_env workon local_envInstall python dependecies
pip install -r requirements.txtSet up SSH tunnel to Football database
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" }Start backend server on port 8000
python manage.py runserver 8000
Connecting Both Together¶
Start backend server on port 8000
python manage.py runserver 8000Change 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;Run a HTTP Server in the directory. If you have python installed, you can do the following:
python -m SimpleHTTPServer 8080In 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