Simple Django application to manage (CRUD) users and their bank account data (IBAN).
-
DEBUG(default=False) -
DATABASE_URL(default=postgres://localhost/superman) -
SOCIAL_AUTH_ENABLED(default=True)- Allow users to login via social account, this does not create new users.
-
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY(default=None)- Should be set if
SOCIAL_AUTH_ENABLED=True(see instruction below)
- Should be set if
-
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET(default=None)- Should be set if
SOCIAL_AUTH_ENABLED=True(see instruction below)
- Should be set if
-
Example
.envfile might look like thisDEBUG=True DATABASE_URL=postgres://localhost/superman
- Setup and activate virtualenv
- Run
pip install -r requirements.txt - Run
./manage.py migrate - Create super user
./manage.py createsuperuseror load test users./manage.py loaddata test_users- Password for all test users is
superman!@#
- Password for all test users is
- Visit
http://localhost:8000/and login with admin account or any of test users.
./manage.py test
- Install coverage package
pip install coverage coverage run manage.py test superman.apps.accounts -v 2- To see html report of coverage
coverage html --omit="venv/*"and openindex.htmlin browser
- Visit Google Developer Console
- Create a new project
- Setup Consent Screen
- Create credentials for application type
Web Application - Set Authorized JavaScript origins to
http://localhost:8000 - Set Authorized redirect URIs to
http://localhost:8000/complete/google-oauth2/ - Copy Client ID and Secret Key
-
Install Vagrant and Virtual Box
-
Then, run the following to create a new Django app dev environment on virtual machine
# Start up the virtual machine: $ vagrant up # Stop the virtual machine: $ vagrant halt # Destory the virtual machine: $ vagrant destroy -
Visit
http://localhost:8000/and login withusername=adminandpassword=superman!@#