Skip to content

Commit e663379

Browse files
committed
Initialize a project 'demo' and two apps inside it
1 parent 94064a3 commit e663379

File tree

20 files changed

+254
-1
lines changed

20 files changed

+254
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
db.sqlite3
2+
django-rest-swagger-docs.iml
3+
env

README.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,38 @@
1-
# django-rest-swagger-docs
1+
# Comprehensive approach to django-rest-swagger 2 using both FBV and CBV
2+
3+
For making a DRF project we ll follow: http://www.django-rest-framework.org/tutorial/quickstart/
4+
5+
Start by making the project as in DRF docs:
6+
`mkdir django-rest-swagger-docs`
7+
8+
`cd django-rest-swagger-docs`
9+
10+
Make Virtual Environment with python3 and activate it:
11+
`virtualenv env --python=python3`
12+
13+
`source ./env/bin/activate`
14+
15+
`pip install django`
16+
17+
`pip install djangorestframework`
18+
19+
Make project named 'demo' in current directory:
20+
21+
`django-admin startproject demo .`
22+
23+
`cd demo`
24+
25+
Make two apps inside 'demo' project, 'cbv-demo' for class based views and fbv-demo for function based view:
26+
27+
`django-admin startapp cbv_demo`
28+
29+
`django-admin startapp fbv_demo`
30+
31+
Get back to main project directory:
32+
33+
`cd ..`
34+
35+
Now sync database and create database user:
36+
37+
`python manage.py migrate`
38+
`python manage.py createsuperuser`

demo/__init__.py

Whitespace-only changes.

demo/cbv_demo/__init__.py

Whitespace-only changes.

demo/cbv_demo/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

demo/cbv_demo/apps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class CbvDemoConfig(AppConfig):
5+
name = 'cbv_demo'

demo/cbv_demo/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.db import models
2+
3+
# Create your models here.

demo/cbv_demo/tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.test import TestCase
2+
3+
# Create your tests here.

demo/cbv_demo/views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.shortcuts import render
2+
3+
# Create your views here.

demo/fbv_demo/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)