├── .gitignore ├── .vscode └── settings.json ├── ER Diagram for Banking System.png ├── LICENSE ├── README.md ├── banksystem ├── api │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_account_client.py │ │ ├── 0003_auto_20220427_2232.py │ │ └── __init__.py │ ├── models.py │ ├── serializers.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── banksystem │ ├── __init__.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py └── manage.py ├── course_logo.png ├── headline.md ├── pull_request_template.md └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.pythonPath": "env/bin/python2.7" 3 | } -------------------------------------------------------------------------------- /ER Diagram for Banking System.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/somacode1/Build-a-Banking-System-API-with-DJANGO-Rest-Framework/99e3bf0e3ac5d712b66df3e0116755b287c0092b/ER Diagram for Banking System.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 somacode 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Build a Banking System API with DJANGO Restframework 2 | ![Banking System API Logo](./course_logo.png) 3 | 4 | We're going to take you step-by-step to build a modern, fully open-source,Banking System RESTful API using Python, Django Rest Framework. 5 | 6 | This course will teach you exactly how to build one with Django, Python, Django Rest Framework, and more. 7 | 8 | ### Section 1| Django start project 9 | *1 - Requirements: no code* 10 | 11 | Prerequisites required include: 12 | 13 | - Python 3 14 | - Pip 3 15 | - Virtualenv 16 | - Django == 3.2.9 17 | 18 | #### Django Installation Instructions 19 | 20 | * Make directory in your workspace: 21 | `mkdir banksystem_project` 22 | 23 | * Navigate into `banksystem_project` 24 | 25 | `cd banksystem_project` 26 | 27 | * Create a python virtual environment to install django and other dependecies in the future. 28 | 29 | `virtualenv .env` 30 | 31 | `.env` is the directory where we install the packages. 32 | 33 | * Activate the virtual environment. 34 | 35 | `source .env/bin/activate` 36 | 37 | * Install Django framework. We are going to use `django==3.2.9` in this tutorial. 38 | 39 | `pip3 install django==3.2.9` 40 | 41 | OR 42 | 43 | `pip install django==3.2.9` _If python3 is the default version running._ 44 | 45 | * Create django project: 46 | 47 | `django-admin startproject banksystem` 48 | 49 | 50 | > That's it !!!!! You did it :smiley: :clap: :clap: 51 | 52 | If you want to see the blank project we created follow the link below. 53 | 54 | [1 - Blank Django Project](../../tree/96f545b069e1995c2662529f2d2e0decc1c4281c/) 55 | 56 | 57 | Now lets create an application called `api` inside our project `banksystem`. [To learn more about django applications.](https://docs.djangoproject.com/en/2.1/ref/applications/) 58 | 59 | [2 - Create api app](../../tree/084d648c94b0f11c89cbbcd930e2fce6e3687109/) 60 | 61 | Run the following command in your root folder where `manage.py` lives. 62 | 63 | `./manage.py startapp api` 64 | 65 | The app `api` will be created and your whole project folder structure should look like this. 66 | 67 | ```markdown 68 | 69 | [banksystem_project]/ 70 | ├── [banksystem]/ 71 | │ ├── __init__.py 72 | │ ├── settings.py 73 | │ ├── urls.py 74 | │ └── wsgi.py 75 | |____[api]/ 76 | | |__ __init__.py 77 | | |__ models.py 78 | | |__ views.py 79 | | |__[migrations]/ 80 | | | |___ __init__.py 81 | | | 82 | | |__admin.py 83 | | |__tests.py 84 | | 85 | └── manage.py 86 | ``` 87 | 88 | Include `api` application in django `settings.py` 89 | 90 | ``` 91 | INSTALLED_APPS = [ 92 | 'django.contrib.admin', 93 | 'django.contrib.auth', 94 | 'django.contrib.contenttypes', 95 | 'django.contrib.sessions', 96 | 'django.contrib.messages', 97 | 'django.contrib.staticfiles', 98 | 'api', 99 | ] 100 | 101 | ``` 102 | 103 | [Learn about django project structure.](https://django-project-skeleton.readthedocs.io/en/latest/structure.html) 104 | 105 | ### Section 2| Django Rest Framework 106 | 107 | *1 - Introduction: no code* 108 | 109 | [2 - Install Django Rest Framework](../../tree/63ae3a627606d74c9e4f6128ccd1ec686104585a/) 110 | 111 | Install using `pip` ... 112 | 113 | ``` 114 | pip install djangorestframework====3.12.4 115 | pip install Markdown==3.3.6 # Markdown support for the browsable API. 116 | pip install django-filter==21.1 # Filtering support 117 | ``` 118 | 119 | Add `'rest_framework'` to your `INSTALLED_APPS` setting in `settings.py`. 120 | 121 | ``` 122 | INSTALLED_APPS = ( 123 | ... 124 | 'rest_framework', 125 | ) 126 | ``` 127 | 128 | If you're intending to use the browsable API you'll probably also want to add REST framework's login and logout views. Add the following to your root`urls.py` file. Location of **urls.py** `banksystem_project/banksystem/urls.py` 129 | 130 | ``` 131 | urlpatterns = [ 132 | ... 133 | url(r'^api-auth/', include('rest_framework.urls')) 134 | ] 135 | ``` 136 | 137 | Note that the URL path can be whatever you want. 138 | 139 | [3 - Creating Bank System Models](../../tree/bc2272e009fa1dcb8719155d5b603b74c9e02e74/) 140 | 141 | [4 - Creating Serailizers](../../tree/93b845ccda9d5430dd5e447ec250f5a883d3a55f/) 142 | 143 | [4 - Implementing Branch & Bank Endpoints Using generic views](../../tree/48c31204adf47262acdda05c44742393e25ec39e/) 144 | 145 | 170 | 212 | 213 | *42 - Final wrap-up: no code* 214 | -------------------------------------------------------------------------------- /banksystem/api/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/somacode1/Build-a-Banking-System-API-with-DJANGO-Rest-Framework/99e3bf0e3ac5d712b66df3e0116755b287c0092b/banksystem/api/__init__.py -------------------------------------------------------------------------------- /banksystem/api/admin.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | from django.contrib import admin 5 | from .models import ( 6 | Branch, 7 | Bank 8 | ) 9 | 10 | # Register your models here. 11 | admin.site.register(Branch) 12 | admin.site.register(Bank) 13 | 14 | -------------------------------------------------------------------------------- /banksystem/api/apps.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | from django.apps import AppConfig 5 | 6 | 7 | class ApiConfig(AppConfig): 8 | name = 'api' 9 | -------------------------------------------------------------------------------- /banksystem/api/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2019-02-06 09:00 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | initial = True 12 | 13 | dependencies = [ 14 | ] 15 | 16 | operations = [ 17 | migrations.CreateModel( 18 | name='Account', 19 | fields=[ 20 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 21 | ('name', models.CharField(max_length=250)), 22 | ('open_date', models.CharField(max_length=250)), 23 | ('account_type', models.CharField(max_length=250)), 24 | ], 25 | ), 26 | migrations.CreateModel( 27 | name='Bank', 28 | fields=[ 29 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 30 | ('name', models.CharField(max_length=250)), 31 | ], 32 | ), 33 | migrations.CreateModel( 34 | name='Branch', 35 | fields=[ 36 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 37 | ('name', models.CharField(max_length=250)), 38 | ('address', models.CharField(max_length=250)), 39 | ('branch_code', models.CharField(max_length=250)), 40 | ], 41 | ), 42 | migrations.CreateModel( 43 | name='Client', 44 | fields=[ 45 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 46 | ('name', models.CharField(max_length=250)), 47 | ('address', models.CharField(max_length=250)), 48 | ], 49 | ), 50 | migrations.CreateModel( 51 | name='ClientManager', 52 | fields=[ 53 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 54 | ('name', models.CharField(max_length=250)), 55 | ], 56 | ), 57 | migrations.CreateModel( 58 | name='Deposit', 59 | fields=[ 60 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 61 | ('amount', models.FloatField()), 62 | ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Account')), 63 | ], 64 | ), 65 | migrations.CreateModel( 66 | name='Transfer', 67 | fields=[ 68 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 69 | ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Account')), 70 | ('branch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Branch')), 71 | ], 72 | ), 73 | migrations.CreateModel( 74 | name='Withdraw', 75 | fields=[ 76 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 77 | ('amount', models.FloatField()), 78 | ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Account')), 79 | ], 80 | ), 81 | migrations.AddField( 82 | model_name='bank', 83 | name='branch', 84 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Branch'), 85 | ), 86 | migrations.AddField( 87 | model_name='account', 88 | name='bank', 89 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Bank'), 90 | ), 91 | ] 92 | -------------------------------------------------------------------------------- /banksystem/api/migrations/0002_account_client.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.9 on 2021-11-22 19:14 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('api', '0001_initial'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='account', 16 | name='client', 17 | field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='api.client'), 18 | preserve_default=False, 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /banksystem/api/migrations/0003_auto_20220427_2232.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.9 on 2022-04-27 19:32 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('api', '0002_account_client'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='branch', 15 | options={'verbose_name_plural': 'Branches'}, 16 | ), 17 | migrations.RemoveField( 18 | model_name='account', 19 | name='name', 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /banksystem/api/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/somacode1/Build-a-Banking-System-API-with-DJANGO-Rest-Framework/99e3bf0e3ac5d712b66df3e0116755b287c0092b/banksystem/api/migrations/__init__.py -------------------------------------------------------------------------------- /banksystem/api/models.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | from django.db import models 5 | 6 | # Create your models here. 7 | class Branch(models.Model): 8 | name = models.CharField(max_length=250) 9 | address = models.CharField(max_length=250) 10 | branch_code = models.CharField(max_length=250) 11 | 12 | class Meta: 13 | verbose_name_plural = "Branches" 14 | 15 | 16 | 17 | def json_object(self): 18 | return { 19 | "name":self.name, 20 | "address":self.address, 21 | "branch_code":self.branch_code 22 | } 23 | 24 | def __str__(self): 25 | return self.name 26 | 27 | class Bank(models.Model): 28 | name = models.CharField(max_length=250) 29 | branch = models.ForeignKey(Branch,on_delete=models.CASCADE) 30 | 31 | 32 | def json_object(self): 33 | return { 34 | "name": self.name, 35 | "branch": self.branch 36 | } 37 | 38 | def __str__(self): 39 | return self.name 40 | 41 | class ClientManager(models.Model): 42 | name = models.CharField(max_length=250) 43 | 44 | def __str__(self): 45 | return self.name 46 | 47 | 48 | class Client(models.Model): 49 | name = models.CharField(max_length=250) 50 | address = models.CharField(max_length=250) 51 | 52 | def json_object(self): 53 | return { 54 | "name":self.name, 55 | "address":self.address 56 | } 57 | 58 | def __str_(self): 59 | return self.name 60 | 61 | 62 | 63 | class Account(models.Model): 64 | """Represents Bank Account""" 65 | client = models.ForeignKey(Client,on_delete=models.CASCADE) 66 | open_date = models.CharField(max_length=250) 67 | account_type = models.CharField(max_length=250) 68 | bank = models.ForeignKey(Bank,on_delete=models.CASCADE) 69 | 70 | 71 | def json_object(self): 72 | return { 73 | "open_date":self.open_date, 74 | "account_type":self.account_type, 75 | "bank":self.bank 76 | 77 | } 78 | 79 | def __str__(self): 80 | return self.account_type 81 | 82 | 83 | class Transfer(models.Model): 84 | account = models.ForeignKey(Account,on_delete=models.CASCADE) 85 | branch = models.ForeignKey(Branch,on_delete=models.CASCADE) 86 | 87 | def json_object(self): 88 | return { 89 | "account":self.account, 90 | "branch":self.branch 91 | } 92 | 93 | def __str__(self): 94 | return "Account Transfered to {} Branch".format(self.branch.name) 95 | 96 | 97 | class Withdraw(models.Model): 98 | amount = models.FloatField() 99 | account = models.ForeignKey(Account,on_delete=models.CASCADE) 100 | 101 | 102 | class Deposit(models.Model): 103 | amount = models.FloatField() 104 | account = models.ForeignKey(Account,on_delete=models.CASCADE) 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /banksystem/api/serializers.py: -------------------------------------------------------------------------------- 1 | from rest_framework import serializers 2 | 3 | from .models import * 4 | 5 | 6 | 7 | class BranchSerializer(serializers.ModelSerializer): 8 | class Meta: 9 | model = Branch 10 | fields = ('name','address','branch_code',) 11 | read_only_fields = ('id',) 12 | 13 | class BranchDetailSerializer(serializers.ModelSerializer): 14 | class Meta: 15 | model = Branch 16 | fields = ('__all__') 17 | 18 | 19 | class BankSerializer(serializers.ModelSerializer): 20 | branch = BranchSerializer() 21 | class Meta: 22 | model = Bank 23 | fields = ('__all__') 24 | 25 | 26 | class ClientManagerSerializer(serializers.ModelSerializer): 27 | class Meta: 28 | model = ClientManager 29 | fields = ('__all__') 30 | 31 | 32 | class ClientSerializer(serializers.ModelSerializer): 33 | class Meta: 34 | model = Client 35 | fields = ('__all__') 36 | 37 | 38 | class AccountSerializer(serializers.ModelSerializer): 39 | client = ClientSerializer() 40 | bank = BankSerializer() 41 | class Meta: 42 | model = Account 43 | fields = ('__all__') 44 | 45 | 46 | 47 | class TransferSerializer(serializers.ModelSerializer): 48 | class Meta: 49 | model = Transfer 50 | fields = ('__all__') 51 | 52 | 53 | class WithdrawSerializer(serializers.ModelSerializer): 54 | class Meta: 55 | model = Withdraw 56 | fields = ('__all__') 57 | 58 | 59 | class DepositSerializer(serializers.ModelSerializer): 60 | class Meta: 61 | model = Deposit 62 | fields = ('__all__') -------------------------------------------------------------------------------- /banksystem/api/tests.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | from django.test import TestCase 5 | 6 | # Create your tests here. 7 | -------------------------------------------------------------------------------- /banksystem/api/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | 3 | from .views import ( 4 | BranchesAPIView, 5 | BranchDetailAPIView, 6 | BanksAPIView, 7 | BankDetailAPIView, 8 | CreateAccountAPIView, 9 | AccountListAPIView 10 | 11 | ) 12 | 13 | urlpatterns = [ 14 | url(r'^branches/', BranchesAPIView.as_view(),name='branches'), 15 | url(r'^branch/(?P[0-9]+)/', BranchDetailAPIView.as_view(),name='branch-detail'), 16 | url(r'^banks', BanksAPIView.as_view(), name='banks'), 17 | url(r'^bank/(?P[0-9]+)/', BankDetailAPIView.as_view(), name='bank-detail'), 18 | url(r'^create_account/', CreateAccountAPIView.as_view(), name='create-account'), 19 | url(r'^accounts/', AccountListAPIView.as_view(), name='accounts'), 20 | 21 | 22 | ] -------------------------------------------------------------------------------- /banksystem/api/views.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | from django.shortcuts import render 5 | from django.http import Http404 6 | 7 | from rest_framework import generics,status 8 | from rest_framework.response import Response 9 | from rest_framework.views import APIView 10 | 11 | from .models import * 12 | from .serializers import * 13 | 14 | 15 | class BranchesAPIView(generics.ListCreateAPIView): 16 | queryset = Branch.objects.all() 17 | serializer_class = BranchSerializer 18 | 19 | class BranchDetailAPIView(generics.RetrieveUpdateDestroyAPIView): 20 | queryset = Branch.objects.all() 21 | serializer_class = BranchSerializer 22 | 23 | class BanksAPIView(generics.ListCreateAPIView): 24 | queryset = Bank.objects.all() 25 | serializer_class = BankSerializer 26 | 27 | class BankDetailAPIView(generics.RetrieveUpdateDestroyAPIView): 28 | queryset = Bank.objects.all() 29 | serializer_class = BankSerializer 30 | 31 | class CreateAccountAPIView(APIView): 32 | 33 | def post(self,request): 34 | """ 35 | { 36 | "full_name": "John Doe", 37 | "address": "123 Main St", 38 | "open_date": "2018-01-01", 39 | "account_type": "savings", 40 | "bank": 1 41 | 42 | } 43 | """ 44 | client = Client.objects.create( 45 | name = request.data['full_name'], 46 | address = request.data['address'] 47 | ) 48 | bank = Bank.objects.get(pk=request.data['bank']) 49 | account = Account.objects.create( 50 | client = client, 51 | open_date = request.data['open_date'], 52 | account_type = request.data['account_type'], 53 | bank = bank 54 | ) 55 | 56 | serializer = AccountSerializer(account) 57 | return Response(serializer.data,status=status.HTTP_201_CREATED) 58 | 59 | class AccountListAPIView(generics.ListAPIView): 60 | queryset = Account.objects.all() 61 | serializer_class = AccountSerializer -------------------------------------------------------------------------------- /banksystem/banksystem/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/somacode1/Build-a-Banking-System-API-with-DJANGO-Rest-Framework/99e3bf0e3ac5d712b66df3e0116755b287c0092b/banksystem/banksystem/__init__.py -------------------------------------------------------------------------------- /banksystem/banksystem/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for banksystem project. 3 | 4 | Generated by 'django-admin startproject' using Django 1.11. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.11/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/1.11/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'q0^+h6!2wsdlc@rnbqavh!4qq$m^gg_56m)b=ae&2cy2!i6kfh' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = ['*'] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'api', 41 | 'rest_framework', 42 | ] 43 | 44 | MIDDLEWARE = [ 45 | 'django.middleware.security.SecurityMiddleware', 46 | 'django.contrib.sessions.middleware.SessionMiddleware', 47 | 'django.middleware.common.CommonMiddleware', 48 | 'django.middleware.csrf.CsrfViewMiddleware', 49 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 50 | 'django.contrib.messages.middleware.MessageMiddleware', 51 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 52 | ] 53 | 54 | ROOT_URLCONF = 'banksystem.urls' 55 | 56 | TEMPLATES = [ 57 | { 58 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 59 | 'DIRS': [], 60 | 'APP_DIRS': True, 61 | 'OPTIONS': { 62 | 'context_processors': [ 63 | 'django.template.context_processors.debug', 64 | 'django.template.context_processors.request', 65 | 'django.contrib.auth.context_processors.auth', 66 | 'django.contrib.messages.context_processors.messages', 67 | ], 68 | }, 69 | }, 70 | ] 71 | 72 | WSGI_APPLICATION = 'banksystem.wsgi.application' 73 | 74 | 75 | # Database 76 | # https://docs.djangoproject.com/en/1.11/ref/settings/#databases 77 | 78 | DATABASES = { 79 | 'default': { 80 | 'ENGINE': 'django.db.backends.sqlite3', 81 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 82 | } 83 | } 84 | 85 | DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' 86 | 87 | # Password validation 88 | # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators 89 | 90 | AUTH_PASSWORD_VALIDATORS = [ 91 | { 92 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 93 | }, 94 | { 95 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 96 | }, 97 | { 98 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 99 | }, 100 | { 101 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 102 | }, 103 | ] 104 | 105 | 106 | # Internationalization 107 | # https://docs.djangoproject.com/en/1.11/topics/i18n/ 108 | 109 | LANGUAGE_CODE = 'en-us' 110 | 111 | TIME_ZONE = 'UTC' 112 | 113 | USE_I18N = True 114 | 115 | USE_L10N = True 116 | 117 | USE_TZ = True 118 | 119 | 120 | # Static files (CSS, JavaScript, Images) 121 | # https://docs.djangoproject.com/en/1.11/howto/static-files/ 122 | 123 | STATIC_URL = '/static/' 124 | -------------------------------------------------------------------------------- /banksystem/banksystem/urls.py: -------------------------------------------------------------------------------- 1 | """banksystem URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.11/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import include,url 17 | from django.contrib import admin 18 | 19 | urlpatterns = [ 20 | url(r'^admin/', admin.site.urls), 21 | url(r'^api-auth/', include('rest_framework.urls')), 22 | url(r'^api/', include('api.urls')) 23 | ] 24 | -------------------------------------------------------------------------------- /banksystem/banksystem/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for banksystem project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "banksystem.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /banksystem/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "banksystem.settings") 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError: 10 | # The above import may fail for some other reason. Ensure that the 11 | # issue is really that Django is missing to avoid masking other 12 | # exceptions on Python 2. 13 | try: 14 | import django 15 | except ImportError: 16 | raise ImportError( 17 | "Couldn't import Django. Are you sure it's installed and " 18 | "available on your PYTHONPATH environment variable? Did you " 19 | "forget to activate a virtual environment?" 20 | ) 21 | raise 22 | execute_from_command_line(sys.argv) 23 | -------------------------------------------------------------------------------- /course_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/somacode1/Build-a-Banking-System-API-with-DJANGO-Rest-Framework/99e3bf0e3ac5d712b66df3e0116755b287c0092b/course_logo.png -------------------------------------------------------------------------------- /headline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/somacode1/Build-a-Banking-System-API-with-DJANGO-Rest-Framework/99e3bf0e3ac5d712b66df3e0116755b287c0092b/headline.md -------------------------------------------------------------------------------- /pull_request_template.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. 4 | 5 | Example 6 | This pull request is part of the work to make it easier for people to contribute to naming convention guides. One of the easiest way to make small changes would be using the Edit on Github button. 7 | 8 | To achieve this, we needed to: 9 | - Find the best Gitbook plugin which can do the work 10 | - Integrate it in all the pages to redirect the user to the right page on GitHub for editing 11 | - Make it visible on the page so users can notice it easily 12 | 13 | 14 | 15 | Fixes # (issue) - *Example*: Fixes # ([S4Y-400](https://www.w3.org/Provider/Style/dummy.html), [S4Y-100](https://www.w3.org/Provider/Style/dummy.html)) 16 | 17 | ## Type of change 18 | 19 | Please delete options that are not relevant. 20 | 21 | - [ ] Bug fix (non-breaking change which fixes an issue) 22 | - [ ] New feature (non-breaking change which adds functionality) 23 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 24 | - [ ] This change requires a documentation update 25 | 26 | # Screenshot (optional) 27 | 28 | # How Has This Been Tested? 29 | 30 | Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration if necessary. 31 | 32 | - [ ] Test A 33 | - [ ] Test B 34 | 35 | **Test Configuration**: (optional) 36 | * Firmware version: 37 | * Hardware: 38 | * Toolchain: 39 | * SDK: 40 | 41 | # Checklist: 42 | 43 | - [ ] My code follows the style guidelines of this project 44 | - [ ] I have performed a self-review of my code 45 | - [ ] I have commented my code, particularly in hard-to-understand areas 46 | - [ ] I have made corresponding changes to the documentation 47 | - [ ] My changes generate no new warnings 48 | - [ ] I have added tests that prove my fix is effective or that my feature works 49 | - [ ] New and existing unit tests pass locally with my changes 50 | - [ ] Any dependent changes have been merged and published in downstream modules 51 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Django == 3.2.9 2 | djangorestframework==3.12.4 3 | Markdown==3.3.6 4 | django-filter==21.1 --------------------------------------------------------------------------------