Django REST Framework with Unit TEST
create a folder in login directory
mkdir djangorest
cd djangorest
create a virtualenv named env
python3 -m venv env
Verify that virtualenv is working. (at the beginning of the command request (env))
(env) ~$ pip install --upgrade pip
then install django
(env) ~$ pip3 install django
(env) ~$ pip3 install djangorestframework
Update settings.py
# REST Framework
INSTALLED_APPS = [
'rest_framework'
]
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': [],
'TEST_REQUEST_DEFAULT_FORMAT': 'json'
}
Create the Database
python manage.py makemigrations
python manage.py migrate
Run tests
python manage.py test