-
Docker installation on ubuntu https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04
-
Docker installation on mac https://docs.docker.com/docker-for-mac/install/#install-and-run-docker-for-mac
-
Docker installation on windows https://docs.docker.com/toolbox/toolbox_install_windows/#step-3-verify-your-installation
-
To donwload Docker image, please use link http://progfeel.co.in/iban/iban.tar
-
After installation of docker please ensure docker service is running. Once it is confirmed, import image into it
docker load < iban.tar
-
To list all available images Run command :
docker images
- It will list all the available images of the system. Our imported image details are
REPOSITORY | TAG | IMAGE ID |
---|---|---|
be5a177f67c9 | latest | 7a1253b9d0fb |
-
Now run the docker container and connect ports on which docker services are running with ports of host machine using following command.
-
docker run -i -t -p 8000:8000 -p 8001:8001 -p 8002:8002 -p 8003:8003 -p 8004:8004 be5a177f67c9:latest /bin/bash
-
be5a177f67c9 is repository name and latest is tag name.
-
Docker imported image [id] may be different one. Please find image id of uploaded image from
docker images
command and use in below command -
docker run -i -t -p 8000:8000 -p 8001:8001 -p 8002:8002 -p 8003:8003 -p 8004:8004 imageID /bin/bash
For more clarification -
You will land into the container. Now check postgresql status.
service postgresql status
-
If it is not running, run it using
service postgresql start
-
If virtual environment iban is not active then enable it using following command.
-
workon iban
-
Run python server
-
cd /root/iban
-
python manage.py runserver 0.0.0.0:8000
-
cd /root/iban2
-
python manage.py runserver 0.0.0.0:8001
-
cd /root/iban3
-
python manage.py runserver 0.0.0.0:8002
-
cd /root/iban4
-
python manage.py runserver 0.0.0.0:8003
-
cd /root/iban5
-
python manage.py runserver 0.0.0.0:8004
-
Now exit container but make it running.
ctrl p + q
(three keys ctrl p and q) -
Now open browser and run
http://localhost:8000 (dev1) superuser credentials are : anupy27 / Splendornet@123
http://localhost:8001 (dev2) superuser credentials are : anupy27 / Splendornet@123
http://localhost:8002 (dev3) superuser credentials are : anupy27 / Splendornet@123
http://localhost:8003 (dev4) superuser credentials are : anupy27 / Splendornet@123
http://localhost:8004 (dev5) superuser credentials are : anupy27 / Splendornet@123
(All below steps are already completed in docker image so no need to follow anything. It is already followed in docker image.)
But to know working environment Please check this
-
Require Python 3.x
-
git clone from github
git clone https://github.com/anupy/iban.git dev1
-
Setup virtualenvwrapper Ref: https://virtualenvwrapper.readthedocs.io/en/latest/
-
We can alias to Python in my case it is python3 to execute version 3
-
alias python3='/usr/bin/python3'
-
sudo apt-get -y install python3-pip
One time only -
pip install virtualenvwrapper
ORpip3 install virtualenvwrapper
pip3 is soft link / alias. -
export WORKON_HOME=~/Envs
-
mkdir -p $WORKON_HOME
-
source /usr/local/bin/virtualenvwrapper.sh
This can achieved using Ref: https://stackoverflow.com/questions/21928555/virtualenv-workon-command-not-found -
mkvirtualenv iban
-
pip3 install django==1.11
-
Daily we need only to fire command like
workon iban
to enter specific python version to execute code. -
Ensure Django version by typing
python -m django --version
-
django-admin startproject ibanapp Ref: https://docs.djangoproject.com/en/1.11/intro/tutorial01/
-
Now install postgresql 9.3.x using
apt-get install postgresql
-
To check installation and version fire command
psql --version
-
Once setup is done, create database in postgres called iban
-
Set username and password for database iban
-
Now run migrate command to set initial database with tables.
python manage.py migrate
-
Now we have added model called IbanDetails and altered email field to unique to add this change into database fire below commands.
-
python manage.py makemigrations
-
python manage.py makemigrations ibanmanagment
(To ensure, otherwise first command get all the migrations) -
python manage.py makemigrations oauth
(To ensure, otherwise first command get all the migrations) -
python manage.py migrate
-
We will create supreadmin through command line.
-
Command would be
python manage.py createsuperuser --username=anupy27 [email protected]
now you'll will requested to add password of 8 characters. -
Superadmin will have all access, so we will create group called admin with permission of add, edit, delete of iban_details. (This is important)
-
##### OR #####
-
To autoload permissions and create group through command line instead of creating from superuser, please fire below command.
-
python manage.py loaddata oauth/fixtures/permission_group.json
It will return text as Installed 4 objects from 1 fixture.
-
python manage.py runserver
-
python manage.py runserver 0.0.0.0:8000
To run on specific port. -
python manage.py runserver 0.0.0.0:8000 --settings=iban.settings
to run on specific port and with specific settings. -
Supreadmin call login through [http://127.0.0.1:8000/admin/login/] (http://127.0.0.1:8000/admin/login/) URL.
-
Now http://127.0.0.1:8000/ here will ask Administrator to to come and register yourself.
-
Administrator will be registered from Gmail but activation would be done from SuperAdmin only.
-
If Administrator is already registered and activated then he will be allowed to login to website else appropriate message will be shown (Activation or Non admin).
-
If Administrator access is already assigned to user through code, then Superadmin won't need to assign admin group / permissions to that user else he need to assign explicitely.
-
While Authenticating through Google OAuth if email is exists in database but admin access is not then he will not be allowed to enter into website.
-
Once everything is fine and Administrator got authenticated he will redirected to Dashboard to manage CRUD of iban_details.
-
He can logout through website using logout link, logout through gmail won't affect to our website.
python manage.py test oauth.tests.OauthTestCase.run_all_test
./manage.py test oauth.tests.OauthTestCase.check_account_exist_or_create_test_new_user
./manage.py test oauth.tests.OauthTestCase.check_account_exist_or_create_test
./manage.py test oauth.tests.OauthTestCase.check_account_exist_or_create_test_is_active
./manage.py test oauth.tests.OauthTestCase.check_account_exist_or_create_test_is_superadmin
./manage.py test oauth.tests.OauthTestCase.check_account_exist_or_create_test_is_admin
./manage.py test ibanmanagment.tests.tests_model.IbanModelTestCase.test_iban_details_model
./manage.py test ibanmanagment.tests.tests_model.IbanModelTestCase.test_str_is_equal_to_iban_number
./manage.py test ibanmanagment.tests.tests_form.IbanFormTestCase.test_form_success
./manage.py test ibanmanagment.tests.tests_form.IbanFormTestCase.test_form_error
./manage.py test ibanmanagment.tests.tests_form.IbanFormTestCase.test_form_error
./manage.py test ibanmanagment.tests.tests_list_views.IbanViewTestCase.dashboard_negative_test
./manage.py test ibanmanagment.tests.tests_list_views.IbanViewTestCase.dashboard_list_test
./manage.py test ibanmanagment.tests.tests_list_views.IbanViewTestCase.dashboard_no_list_test
./manage.py test ibanmanagment.tests.tests_create_update_delete_views.IbanCreateUpdateDeleteViewTestCase.iban_create_update_delete_test_permission
./manage.py test ibanmanagment.tests.tests_create_update_delete_views.IbanCreateUpdateDeleteViewTestCase.iban_create_update_delete_test_valid