Development Reference Notes:

Part 1: Install anaconda https://www.anaconda.com/download/

Part 2: Setting Up Django Models Note: Virtual enviroment are useful to test the project on different versions of dependency libraries

Step 1: Create a new python 3.5 along with other useful python libraries in a virtual enviroment called unicefenv Command : conda create -n unicefenv python==3.5 anaconda

Step 2: Activate the virtual enviroment.(This is for windows. Some conda commands can vary for different OS ) Command: activate unicefenv

Step 3: Install a stable version of Django to the unicefenv Command: pip install django==2.0.3

Step 4: Create a django project Command: django-admin startproject unicefproject

Step 5: Create an app inside the unicefproject Commands: cd unicefproject(Go into the directory) python manage.py startapp magicbox

Step 6: Register the app in unicefproject settings.py file. image

Step 7: Create models in the unicefproject/magicbox/models.py Note: Models are database tables created using Django ORM image

The above model can be roughly represented by the schema drawn below: image

Step 8: Register the model in unicefproject/magicbox/models.py image

Step 9: Step back one folder and run the the following commands: python manage.py migrate python manage.py makemigrations python manage.py migrate

Steep 10: In order to see the tables we created we needs to start Django on the server and see it throught the admin file. Before starting the server create a superuser. Commands: python manage.py createsuperuser It will prompt you for a username and password. My username and passowrd are vinit and admin1234

Step 11: Start the server. Commands: python manage.py runserver

Step 12: This will start running a virtual server running at 127.0.0.1:8000 image

Step 13: Now log on to you django admin to see the models that are created. Hit this URL : 127.0.0.1:8000/admin Now you will be able to see the models you created. Note: you will be required to log in with the super user details. image

Step 14: Now run the unicefproject/providerandcountryDB.py file to populate the ProviderandCountry database Table. Command: python providerandcountryDB.py In the admin panel an new entry will be created like this: image

Step 15: Now run the unicefproject/ColumbiaDB.py file to populate the CoulmbiaData database Table. This file uses pandas to read the csv file and populate the table accordingly. Command: python ColumbiaDB.py In the admin panel an new entry will be created like this: image

Step 16: Now run the unicefproject/DRFDB.py file to populate the DRFData database Table.This file uses pandas to read the csv file and populate the table accordingly. Command: python DRFDB.py In the admin panel an new entry will be created like this: image