Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Steps taken for migrating badgr from v1 to v2.

Step 1) Clone the latest version from github.

...

  1. Download and install PostgreSQL (https://www.postgresql.org/download/). Create a database using pgAdmin 4 (e.g. ‘badgrDB’).

  2. Install virtualenv.

sudo pip install virtualenv virtualenvwrapper

  1. Run following commands to setup badgr.

mkdir badgr && cd badgr

virtualenv env

source env/bin/activate

git clone https://github.com/concentricsky/badgr-server.git

Step 2) Create virtaulenv from the badgr directory by command.

$ virtualenv env

Step 3) Once virtualenv is created, activate it.

$ source env/bin/activate

Step 4) Start the badgr server from code directory.

$ cd code

$ ./manage.py migrate //This step assumes that your postgres is up and running and details are updated in settings.py file

$ ./manage.py runserver

Step 5) Open the localhost:8000 in browser to check if badgr server started successfully.

localhost:8000/staff and create one staff code

cd code

pip install -r requirements-dev.txt

npm install

cp apps/mainsite/settings_local.py.example apps/mainsite/settings_local.py

Edit the settings_local.py file and insert local credentials for DATABASES

e.g.

DATABASES = {

Code Block
'default': {

    'ENGINE': 'django.db.backends.postgresql_psycopg2', # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.

    'NAME': 'badgrDB',                      # Or path to database file if using sqlite3.

    'USER': 'postgres',                      # Not used with sqlite3.

    'PASSWORD': 'postgres',                  # Not used with sqlite3.

    'HOST': 'localhost',                      # Set to empty string for localhost. Not used with sqlite3.

    'PORT': '5432',                      # Set to empty string for default. Not used with sqlite3.

    'OPTIONS': {
      }
    }


put this line on top in code/apps/mainsite/settings_local.py
import string
pip install psycopg2

#Before running this -- (make sure you set security_key in apps/mainsite/settings.py )
./manage.py migrate

./manage.py createsuperuser

###Generate swagger file
./manage.py dist
4) Run badgr server.

Before running badgr server, we need to put the host in settings_local.py at line 117, for local use below line
ALLOWED_HOSTS = [u'localhost', ]

./manage.py runserver

  1. Navigate to http://localhost:8000/accounts/login. Login, verify email address. (Note: Verify link is present in badgr server log).

  2. API reference is available at http://127.0.0.1:8000/docs/