Django Run book:
1. Django-Configuration and installation –
C:\Users\10711484>python --version
Python 3.10.4
C:\Users\10711484>cd "C:\Users\10711484\Documents\Python Projects\
Django backend Mini Projects"
C:\Users\10711484\Documents\Python Projects\Django backend Mini
Projects>mkvirtualenv rest_api_env
'mkvirtualenv' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\10711484\Documents\Python Projects\Django backend
Mini Projects>pip install virtualenvwrapper-win
Collecting virtualenvwrapper-win
Using cached virtualenvwrapper_win-1.2.7-py3-none-any.whl.metadata
(10 kB)
Collecting virtualenv (from virtualenvwrapper-win)
Using cached virtualenv-20.34.0-py3-none-any.whl.metadata (4.6 kB)
Collecting distlib<1,>=0.3.7 (from virtualenv->virtualenvwrapper-win)
Using cached distlib-0.4.0-py2.py3-none-any.whl.metadata (5.2 kB)
Collecting filelock<4,>=3.12.2 (from virtualenv->virtualenvwrapper-win)
Downloading filelock-3.19.1-py3-none-any.whl.metadata (2.1 kB)
Collecting platformdirs<5,>=3.9.1 (from virtualenv->virtualenvwrapper-
win)
Downloading platformdirs-4.3.8-py3-none-any.whl.metadata (12 kB)
Collecting typing-extensions>=4.13.2 (from virtualenv-
>virtualenvwrapper-win)
Downloading typing_extensions-4.14.1-py3-none-any.whl.metadata (3.0
kB)
Using cached virtualenvwrapper_win-1.2.7-py3-none-any.whl (18 kB)
Using cached virtualenv-20.34.0-py3-none-any.whl (6.0 MB)
Using cached distlib-0.4.0-py2.py3-none-any.whl (469 kB)
Downloading filelock-3.19.1-py3-none-any.whl (15 kB)
Downloading platformdirs-4.3.8-py3-none-any.whl (18 kB)
Downloading typing_extensions-4.14.1-py3-none-any.whl (43 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 43.9/43.9 kB 1.1 MB/s
eta 0:00:00
Installing collected packages: distlib, typing-extensions, platformdirs,
filelock, virtualenv, virtualenvwrapper-win
Successfully installed distlib-0.4.0 filelock-3.19.1 platformdirs-4.3.8 typing-
extensions-4.14.1 virtualenv-20.34.0 virtualenvwrapper-win-1.2.7
[notice] A new release of pip is available: 23.3.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
C:\Users\10711484\Documents\Python Projects\Django backend
Mini Projects> python.exe -m pip install --upgrade pip
Requirement already satisfied: pip in c:\users\10711484\appdata\local\
programs\python\python310\lib\site-packages (23.3.1)
Collecting pip
Downloading pip-25.2-py3-none-any.whl.metadata (4.7 kB)
Downloading pip-25.2-py3-none-any.whl (1.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 1.8 MB/s eta
0:00:00
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 23.3.1
Uninstalling pip-23.3.1:
Successfully uninstalled pip-23.3.1
Successfully installed pip-25.2
C:\Users\10711484\Documents\Python Projects\Django backend
Mini Projects>pip install virtualenvwrapper-win
Requirement already satisfied: virtualenvwrapper-win in c:\users\
10711484\appdata\local\programs\python\python310\lib\site-packages
(1.2.7)
Requirement already satisfied: virtualenv in c:\users\10711484\appdata\
local\programs\python\python310\lib\site-packages (from
virtualenvwrapper-win) (20.34.0)
Requirement already satisfied: distlib<1,>=0.3.7 in c:\users\10711484\
appdata\local\programs\python\python310\lib\site-packages (from
virtualenv->virtualenvwrapper-win) (0.4.0)
Requirement already satisfied: filelock<4,>=3.12.2 in c:\users\10711484\
appdata\local\programs\python\python310\lib\site-packages (from
virtualenv->virtualenvwrapper-win) (3.19.1)
Requirement already satisfied: platformdirs<5,>=3.9.1 in c:\users\
10711484\appdata\local\programs\python\python310\lib\site-packages
(from virtualenv->virtualenvwrapper-win) (4.3.8)
Requirement already satisfied: typing-extensions>=4.13.2 in c:\users\
10711484\appdata\local\programs\python\python310\lib\site-packages
(from virtualenv->virtualenvwrapper-win) (4.14.1)
C:\Users\10711484\Documents\Python Projects\Django backend
Mini Projects>pip install virtualenvwrapper
Collecting virtualenvwrapper
Using cached virtualenvwrapper-6.1.1-py3-none-any.whl.metadata (5.1
kB)
Requirement already satisfied: virtualenv in c:\users\10711484\appdata\
local\programs\python\python310\lib\site-packages (from
virtualenvwrapper) (20.34.0)
Collecting virtualenv-clone (from virtualenvwrapper)
Using cached virtualenv_clone-0.5.7-py3-none-any.whl.metadata (2.7 kB)
Collecting stevedore (from virtualenvwrapper)
Downloading stevedore-5.4.1-py3-none-any.whl.metadata (2.3 kB)
Collecting pbr>=2.0.0 (from stevedore->virtualenvwrapper)
Using cached pbr-7.0.0-py2.py3-none-any.whl.metadata (1.4 kB)
Requirement already satisfied: setuptools in c:\users\10711484\appdata\
local\programs\python\python310\lib\site-packages (from pbr>=2.0.0-
>stevedore->virtualenvwrapper) (58.1.0)
Requirement already satisfied: distlib<1,>=0.3.7 in c:\users\10711484\
appdata\local\programs\python\python310\lib\site-packages (from
virtualenv->virtualenvwrapper) (0.4.0)
Requirement already satisfied: filelock<4,>=3.12.2 in c:\users\10711484\
appdata\local\programs\python\python310\lib\site-packages (from
virtualenv->virtualenvwrapper) (3.19.1)
Requirement already satisfied: platformdirs<5,>=3.9.1 in c:\users\
10711484\appdata\local\programs\python\python310\lib\site-packages
(from virtualenv->virtualenvwrapper) (4.3.8)
Requirement already satisfied: typing-extensions>=4.13.2 in c:\users\
10711484\appdata\local\programs\python\python310\lib\site-packages
(from virtualenv->virtualenvwrapper) (4.14.1)
Using cached virtualenvwrapper-6.1.1-py3-none-any.whl (22 kB)
Downloading stevedore-5.4.1-py3-none-any.whl (49 kB)
Using cached pbr-7.0.0-py2.py3-none-any.whl (125 kB)
Using cached virtualenv_clone-0.5.7-py3-none-any.whl (6.6 kB)
Installing collected packages: virtualenv-clone, pbr, stevedore,
virtualenvwrapper
Successfully installed pbr-7.0.0 stevedore-5.4.1 virtualenv-clone-0.5.7
virtualenvwrapper-6.1.1
C:\Users\10711484\Documents\Python Projects\Django backend
Mini Projects>mkvirtualenv rest_api_env
C:\Users\10711484\Envs is not a directory, creating
created virtual environment CPython3.10.4.final.0-64 in 1721ms
creator CPython3Windows(dest=C:\Users\10711484\Envs\rest_api_env,
clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle,
via=copy, app_data_dir=C:\Users\10711484\AppData\Local\pypa\
virtualenv)
added seed packages: pip==25.2, setuptools==80.9.0
activators
BashActivator,BatchActivator,FishActivator,NushellActivator,PowerShellAct
ivator,PythonActivator
(rest_api_env) C:\Users\10711484\Documents\Python Projects\
Django backend Mini Projects>pip install django
Collecting django
Downloading django-5.2.5-py3-none-any.whl.metadata (4.1 kB)
Collecting asgiref>=3.8.1 (from django)
Downloading asgiref-3.9.1-py3-none-any.whl.metadata (9.3 kB)
Collecting sqlparse>=0.3.1 (from django)
Downloading sqlparse-0.5.3-py3-none-any.whl.metadata (3.9 kB)
Collecting tzdata (from django)
Downloading tzdata-2025.2-py2.py3-none-any.whl.metadata (1.4 kB)
Collecting typing_extensions>=4 (from asgiref>=3.8.1->django)
Using cached typing_extensions-4.14.1-py3-none-any.whl.metadata (3.0
kB)
Downloading django-5.2.5-py3-none-any.whl (8.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.3/8.3 MB 1.4 MB/s 0:00:06
Downloading asgiref-3.9.1-py3-none-any.whl (23 kB)
Downloading sqlparse-0.5.3-py3-none-any.whl (44 kB)
Using cached typing_extensions-4.14.1-py3-none-any.whl (43 kB)
Downloading tzdata-2025.2-py2.py3-none-any.whl (347 kB)
Installing collected packages: tzdata, typing_extensions, sqlparse, asgiref,
django
Successfully installed asgiref-3.9.1 django-5.2.5 sqlparse-0.5.3
typing_extensions-4.14.1 tzdata-2025.2
(rest_api_env) C:\Users\10711484\Documents\Python Projects\
Django backend Mini Projects>django-admin startproject
new_django_api
(rest_api_env) C:\Users\10711484\Documents\Python Projects\Django
backend Mini Projects>new_django_api
'new_django_api' is not recognized as an internal or external command,
operable program or batch file.
(rest_api_env) C:\Users\10711484\Documents\Python Projects\
Django backend Mini Projects>cd new_django_api
(rest_api_env) C:\Users\10711484\Documents\Python Projects\
Django backend Mini Projects\new_django_api>code .
(rest_api_env) C:\Users\10711484\Documents\Python Projects\Django
backend Mini Projects\new_django_api>pip install pillow
Collecting pillow
Downloading pillow-11.3.0-cp310-cp310-win_amd64.whl.metadata (9.2
kB)
Downloading pillow-11.3.0-cp310-cp310-win_amd64.whl (7.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.0/7.0 MB 1.4 MB/s 0:00:05
Installing collected packages: pillow
Successfully installed pillow-11.3.0
(rest_api_env) C:\Users\10711484\Documents\Python Projects\
Django backend Mini Projects\new_django_api>python manage.py
makemigrations
SystemCheckError: System check identified some issues:
ERRORS:
AnjaliBlogApp.CustomUser.groups: (fields.E304) Reverse accessor
'Group.user_set' for 'AnjaliBlogApp.CustomUser.groups' clashes with
reverse accessor for 'auth.User.groups'.
HINT: Add or change a related_name argument to the definition for
'AnjaliBlogApp.CustomUser.groups' or 'auth.User.groups'.
AnjaliBlogApp.CustomUser.user_permissions: (fields.E304) Reverse
accessor 'Permission.user_set' for
'AnjaliBlogApp.CustomUser.user_permissions' clashes with reverse
accessor for 'auth.User.user_permissions'.
HINT: Add or change a related_name argument to the definition for
'AnjaliBlogApp.CustomUser.user_permissions' or
'auth.User.user_permissions'.
auth.User.groups: (fields.E304) Reverse accessor 'Group.user_set' for
'auth.User.groups' clashes with reverse accessor for
'AnjaliBlogApp.CustomUser.groups'.
HINT: Add or change a related_name argument to the definition for
'auth.User.groups' or 'AnjaliBlogApp.CustomUser.groups'.
auth.User.user_permissions: (fields.E304) Reverse accessor
'Permission.user_set' for 'auth.User.user_permissions' clashes with reverse
accessor for 'AnjaliBlogApp.CustomUser.user_permissions'.
HINT: Add or change a related_name argument to the definition for
'auth.User.user_permissions' or
'AnjaliBlogApp.CustomUser.user_permissions'.
(rest_api_env) C:\Users\10711484\Documents\Python Projects\
Django backend Mini Projects\new_django_api>python manage.py
makemigrations
Migrations for 'AnjaliBlogApp':
AnjaliBlogApp\migrations\0001_initial.py
+ Create model CustomUser
(rest_api_env) C:\Users\10711484\Documents\Python Projects\Django
backend Mini Projects\new_django_api>python manage.py
makemigrations
No changes detected
(rest_api_env) C:\Users\10711484\Documents\Python Projects\
Django backend Mini Projects\new_django_api>python manage.py
migrate
Operations to perform:
Apply all migrations: AnjaliBlogApp, admin, auth, contenttypes, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0001_initial... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying auth.0012_alter_user_first_name_max_length... OK
Applying AnjaliBlogApp.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying sessions.0001_initial... OK
(rest_api_env) C:\Users\10711484\Documents\Python Projects\
Django backend Mini Projects\new_django_api>python manage.py
createsuperuser
Username: anjalig
Password:
Password (again):
Superuser created successfully.
(rest_api_env) C:\Users\10711484\Documents\Python Projects\
Django backend Mini Projects\new_django_api>python manage.py
runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 18, 2025 - 20:56:42
Django version 5.2.5, using settings 'new_django_api.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
WARNING: This is a development server. Do not use it in a production
setting. Use a production WSGI or ASGI server instead.
For more information on production servers see:
https://docs.djangoproject.com/en/5.2/howto/deployment/
[18/Aug/2025 20:57:11] "GET / HTTP/1.1" 200 12068
Not Found: /favicon.ico
[18/Aug/2025 20:57:11] "GET /favicon.ico HTTP/1.1" 404 2216
[18/Aug/2025 20:57:21] "GET / HTTP/1.1" 200 12068
[18/Aug/2025 20:58:02] "GET /admin/ HTTP/1.1" 302 0
[18/Aug/2025 20:58:02] "GET /admin/login/?next=/admin/ HTTP/1.1" 200
4173
[18/Aug/2025 20:58:03] "GET /static/admin/css/base.css HTTP/1.1" 200
22120
[18/Aug/2025 20:58:03] "GET /static/admin/css/nav_sidebar.css HTTP/1.1"
200 2810
[18/Aug/2025 20:58:03] "GET /static/admin/css/login.css HTTP/1.1" 200
951
[18/Aug/2025 20:58:03] "GET /static/admin/css/dark_mode.css HTTP/1.1"
200 2808
[18/Aug/2025 20:58:03] "GET /static/admin/js/theme.js HTTP/1.1" 200
1653
[18/Aug/2025 20:58:03] "GET /static/admin/css/responsive.css HTTP/1.1"
200 16565
[18/Aug/2025 20:58:03] "GET /static/admin/js/nav_sidebar.js HTTP/1.1"
200 3063
[18/Aug/2025 20:58:13] "POST /admin/login/?next=/admin/ HTTP/1.1" 302
0
[18/Aug/2025 20:58:13] "GET /admin/ HTTP/1.1" 200 6683
[18/Aug/2025 20:58:13] "GET /static/admin/css/dashboard.css HTTP/1.1"
200 441
[18/Aug/2025 20:58:13] "GET /static/admin/img/icon-addlink.svg
HTTP/1.1" 200 331
[18/Aug/2025 20:58:13] "GET /static/admin/img/icon-changelink.svg
HTTP/1.1" 200 380
[18/Aug/2025 20:58:28] "GET /admin/AnjaliBlogApp/ HTTP/1.1" 200 5578
[18/Aug/2025 20:58:32] "GET /admin/AnjaliBlogApp/customuser/
HTTP/1.1" 200 11597
[18/Aug/2025 20:58:32] "GET /static/admin/css/changelists.css HTTP/1.1"
200 6878
[18/Aug/2025 20:58:32] "GET /static/admin/js/jquery.init.js HTTP/1.1" 200
347
[18/Aug/2025 20:58:32] "GET
/static/admin/js/admin/RelatedObjectLookups.js HTTP/1.1" 200 9777
[18/Aug/2025 20:58:32] "GET /static/admin/js/core.js HTTP/1.1" 200 6208
[18/Aug/2025 20:58:32] "GET /static/admin/js/actions.js HTTP/1.1" 200
8076
[18/Aug/2025 20:58:32] "GET /static/admin/js/urlify.js HTTP/1.1" 200 7887
[18/Aug/2025 20:58:32] "GET /static/admin/js/prepopulate.js HTTP/1.1"
200 1531
[18/Aug/2025 20:58:32] "GET /static/admin/img/search.svg HTTP/1.1" 200
458
[18/Aug/2025 20:58:32] "GET /admin/jsi18n/ HTTP/1.1" 200 3342
[18/Aug/2025 20:58:32] "GET /static/admin/img/icon-yes.svg HTTP/1.1"
200 436
[18/Aug/2025 20:58:32] "GET /static/admin/js/vendor/jquery/jquery.js
HTTP/1.1" 200 285314
[18/Aug/2025 20:58:32] "GET /static/admin/js/vendor/xregexp/xregexp.js
HTTP/1.1" 200 325171
[18/Aug/2025 20:58:32] "GET /static/admin/js/filters.js HTTP/1.1" 200 978
[18/Aug/2025 20:58:32] "GET /static/admin/img/tooltag-add.svg HTTP/1.1"
200 331
[18/Aug/2025 20:58:32] "GET /static/admin/img/sorting-icons.svg
HTTP/1.1" 200 1097
[18/Aug/2025 20:58:32] "GET /static/admin/img/icon-viewlink.svg
HTTP/1.1" 200 581
[18/Aug/2025 20:59:16] "GET /admin/AnjaliBlogApp/customuser/1/change/
HTTP/1.1" 200 22064
[18/Aug/2025 20:59:17] "GET /static/admin/js/SelectBox.js HTTP/1.1" 200
4530
[18/Aug/2025 20:59:17] "GET /static/admin/js/admin/DateTimeShortcuts.js
HTTP/1.1" 200 19319
[18/Aug/2025 20:59:17] "GET /static/admin/js/calendar.js HTTP/1.1" 200
9141
[18/Aug/2025 20:59:17] "GET /static/admin/css/forms.css HTTP/1.1" 200
8525
[18/Aug/2025 20:59:17] "GET /static/admin/js/SelectFilter2.js HTTP/1.1"
200 15845
[18/Aug/2025 20:59:17] "GET /admin/jsi18n/ HTTP/1.1" 200 3342
[18/Aug/2025 20:59:17] "GET /static/admin/js/prepopulate_init.js
HTTP/1.1" 200 586
[18/Aug/2025 20:59:17] "GET /static/admin/css/widgets.css HTTP/1.1" 200
11991
[18/Aug/2025 20:59:17] "GET /static/admin/js/change_form.js HTTP/1.1"
200 606
[18/Aug/2025 20:59:17] "GET /static/admin/img/icon-calendar.svg
HTTP/1.1" 200 1086
[18/Aug/2025 20:59:17] "GET /static/admin/img/icon-clock.svg HTTP/1.1"
200 677
[18/Aug/2025 20:59:17] "GET /static/admin/img/selector-icons.svg
HTTP/1.1" 200 3291
[18/Aug/2025 20:59:58] "POST
/admin/AnjaliBlogApp/customuser/1/change/ HTTP/1.1" 302 0
[18/Aug/2025 20:59:58] "GET /admin/AnjaliBlogApp/customuser/
HTTP/1.1" 200 11815
[18/Aug/2025 20:59:58] "GET /admin/jsi18n/ HTTP/1.1" 200 3342
Now development server is ready at :
http://127.0.0.1:8000/
2. Installing Django Rest Framework and Http Request
-Get , Post
(rest_api_env) C:\Users\10711484\Documents\Python
Projects\Django backend Mini Projects\new_django_api>pip
install djangorestframework
Collecting djangorestframework
Downloading djangorestframework-3.16.1-py3-none-
any.whl.metadata (11 kB)
Requirement already satisfied: django>=4.2 in c:\users\10711484\
envs\rest_api_env\lib\site-packages (from djangorestframework)
(5.2.5)
Requirement already satisfied: asgiref>=3.8.1 in c:\users\10711484\
envs\rest_api_env\lib\site-packages (from django>=4.2-
>djangorestframework) (3.9.1)
Requirement already satisfied: sqlparse>=0.3.1 in c:\users\
10711484\envs\rest_api_env\lib\site-packages (from django>=4.2-
>djangorestframework) (0.5.3)
Requirement already satisfied: tzdata in c:\users\10711484\envs\
rest_api_env\lib\site-packages (from django>=4.2-
>djangorestframework) (2025.2)
Requirement already satisfied: typing_extensions>=4 in c:\users\
10711484\envs\rest_api_env\lib\site-packages (from asgiref>=3.8.1-
>django>=4.2->djangorestframework) (4.14.1)
Downloading djangorestframework-3.16.1-py3-none-any.whl (1.1
MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 7.4 MB/s
0:00:00
Installing collected packages: djangorestframework
Successfully installed djangorestframework-3.16.1
(rest_api_env) C:\Users\10711484\Documents\Python
Projects\Django backend Mini Projects\
new_django_api>python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\urls\resolvers.py", line 720, in url_patterns
iter(patterns)
TypeError: 'module' object is not iterable
The above exception was the direct cause of the following
exception:
Traceback (most recent call last):
File "C:\Users\10711484\AppData\Local\Programs\Python\
Python310\lib\threading.py", line 1009, in _bootstrap_inner
self.run()
File "C:\Users\10711484\AppData\Local\Programs\Python\
Python310\lib\threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\core\management\commands\runserver.py", line 134, in
inner_run
self.check(**check_kwargs)
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\core\management\base.py", line 492, in check
all_issues = checks.run_checks(
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\core\checks\registry.py", line 89, in run_checks
new_errors = check(app_configs=app_configs,
databases=databases)
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\core\checks\urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\core\checks\urls.py", line 26, in check_resolver
return check_method()
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\urls\resolvers.py", line 532, in check
messages.extend(check_resolver(pattern))
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\core\checks\urls.py", line 26, in check_resolver
return check_method()
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\urls\resolvers.py", line 531, in check
for pattern in self.url_patterns:
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\utils\functional.py", line 47, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\urls\resolvers.py", line 728, in url_patterns
raise
ImproperlyConfigured(msg.format(name=self.urlconf_name)) from e
django.core.exceptions.ImproperlyConfigured: The included URLconf
'<module 'AnjaliBlogApp.urls' from 'C:\\Users\\10711484\\
Documents\\Python Projects\\Django backend Mini Projects\\
new_django_api\\AnjaliBlogApp\\urls.py'>' does not appear to have
any patterns in it. If you see the 'urlpatterns' variable with valid
patterns in the file then the issue is probably caused by a circular
import.
(rest_api_env) C:\Users\10711484\Documents\Python
Projects\Django backend Mini Projects\
new_django_api>python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 19, 2025 - 01:04:45
Django version 5.2.5, using settings 'new_django_api.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
WARNING: This is a development server. Do not use it in a
production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see:
https://docs.djangoproject.com/en/5.2/howto/deployment/
C:\Users\10711484\Documents\Python Projects\Django backend Mini
Projects\new_django_api\AnjaliBlogApp\urls.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 19, 2025 - 01:04:51
Django version 5.2.5, using settings 'new_django_api.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
WARNING: This is a development server. Do not use it in a
production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see:
https://docs.djangoproject.com/en/5.2/howto/deployment/
C:\Users\10711484\Documents\Python Projects\Django backend Mini
Projects\new_django_api\AnjaliBlogApp\urls.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 19, 2025 - 01:05:07
Django version 5.2.5, using settings 'new_django_api.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
WARNING: This is a development server. Do not use it in a
production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see:
https://docs.djangoproject.com/en/5.2/howto/deployment/
Not Found: /
[19/Aug/2025 01:05:34] "GET / HTTP/1.1" 404 2434
Not Found: /
[19/Aug/2025 01:05:51] "GET / HTTP/1.1" 404 2434
Not Found: //register_user/
[19/Aug/2025 01:06:22] "POST //register_user/ HTTP/1.1" 404 2498
[19/Aug/2025 01:07:00] "GET /admin/AnjaliBlogApp/ HTTP/1.1" 200
5577
[19/Aug/2025 01:07:03] "GET /admin/AnjaliBlogApp/customuser/
HTTP/1.1" 200 11605
[19/Aug/2025 01:07:03] "GET /admin/jsi18n/ HTTP/1.1" 200 3342
[19/Aug/2025 01:07:07] "GET
/admin/AnjaliBlogApp/customuser/1/change/ HTTP/1.1" 200 22092
[19/Aug/2025 01:07:07] "GET /admin/jsi18n/ HTTP/1.1" 200 3342
[19/Aug/2025 01:07:38] "GET /admin/AnjaliBlogApp/ HTTP/1.1" 200
5577
[19/Aug/2025 01:07:59] "GET /register_user HTTP/1.1" 301 0
Internal Server Error: /register_user/
Traceback (most recent call last):
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\core\handlers\exception.py", line 55, in inner
response = get_response(request)
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\core\handlers\base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args,
**callback_kwargs)
File "C:\Users\10711484\Documents\Python Projects\Django
backend Mini Projects\new_django_api\AnjaliBlogApp\views.py", line
8, in register_user
serializer = UserRegisterationSerializer(data=request.data)
AttributeError: 'WSGIRequest' object has no attribute 'data'
[19/Aug/2025 01:07:59] "GET /register_user/ HTTP/1.1" 500 65022
(rest_api_env) C:\Users\10711484\Documents\Python Projects\
Django backend Mini Projects\new_django_api>python manage.py
runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 19, 2025 - 01:08:17
Django version 5.2.5, using settings 'new_django_api.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
WARNING: This is a development server. Do not use it in a
production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see:
https://docs.djangoproject.com/en/5.2/howto/deployment/
Internal Server Error: /register_user/
Traceback (most recent call last):
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\core\handlers\exception.py", line 55, in inner
response = get_response(request)
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\core\handlers\base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args,
**callback_kwargs)
File "C:\Users\10711484\Documents\Python Projects\Django
backend Mini Projects\new_django_api\AnjaliBlogApp\views.py", line
8, in register_user
serializer = UserRegisterationSerializer(data=request.data)
AttributeError: 'WSGIRequest' object has no attribute 'data'
[19/Aug/2025 01:08:43] "GET /register_user/ HTTP/1.1" 500 65159
Not Found: //register_user/
[19/Aug/2025 01:09:02] "POST //register_user/ HTTP/1.1" 404 2498
Forbidden (CSRF cookie not set.): /register_user/
[19/Aug/2025 01:09:16] "POST /register_user/ HTTP/1.1" 403 2855
Not Found: /api/register_user/
[19/Aug/2025 01:09:21] "POST /api/register_user/ HTTP/1.1" 404
2507
C:\Users\10711484\Documents\Python Projects\Django backend Mini
Projects\new_django_api\new_django_api\urls.py changed,
reloading.
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 19, 2025 - 01:10:33
Django version 5.2.5, using settings 'new_django_api.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
WARNING: This is a development server. Do not use it in a
production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see:
https://docs.djangoproject.com/en/5.2/howto/deployment/
Forbidden (CSRF cookie not set.): /api/register_user/
[19/Aug/2025 01:10:48] "POST /api/register_user/ HTTP/1.1" 403
2855
C:\Users\10711484\Documents\Python Projects\Django backend Mini
Projects\new_django_api\AnjaliBlogApp\urls.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 19, 2025 - 01:11:12
Django version 5.2.5, using settings 'new_django_api.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
WARNING: This is a development server. Do not use it in a
production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see:
https://docs.djangoproject.com/en/5.2/howto/deployment/
Not Found: /register_user/
[19/Aug/2025 01:11:21] "GET /register_user/ HTTP/1.1" 404 2372
Not Found: /api/register_user/
[19/Aug/2025 01:11:33] "POST /api/register_user/ HTTP/1.1" 404
2515
(rest_api_env) C:\Users\10711484\Documents\Python
Projects\Django backend Mini Projects\
new_django_api>python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 19, 2025 - 01:17:12
Django version 5.2.5, using settings 'new_django_api.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
WARNING: This is a development server. Do not use it in a
production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see:
https://docs.djangoproject.com/en/5.2/howto/deployment/
Forbidden (CSRF cookie not set.): /register_user/
[19/Aug/2025 01:17:31] "POST /register_user/ HTTP/1.1" 403 2855
Forbidden (CSRF cookie not set.): /register_user/
[19/Aug/2025 01:21:17] "POST /register_user/ HTTP/1.1" 403 2855
Forbidden (CSRF cookie not set.): /register_user/
[19/Aug/2025 01:23:03] "POST /register_user/ HTTP/1.1" 403 2855
C:\Users\10711484\Documents\Python Projects\Django backend Mini
Projects\new_django_api\new_django_api\settings.py changed,
reloading.
CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is
False.
(rest_api_env) C:\Users\10711484\Documents\Python Projects\
Django backend Mini Projects\new_django_api>python manage.py
runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 19, 2025 - 01:27:32
Django version 5.2.5, using settings 'new_django_api.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
WARNING: This is a development server. Do not use it in a
production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see:
https://docs.djangoproject.com/en/5.2/howto/deployment/
Forbidden (CSRF cookie not set.): /register_user/
[19/Aug/2025 01:27:40] "POST /register_user/ HTTP/1.1" 403 2855
Forbidden (CSRF cookie not set.): /register_user/
[19/Aug/2025 01:27:57] "POST /register_user/ HTTP/1.1" 403 2855
[19/Aug/2025 01:33:52] "GET /admin/ HTTP/1.1" 302 0
[19/Aug/2025 01:33:52] "GET /admin/login/?next=/admin/ HTTP/1.1"
200 4173
[19/Aug/2025 01:34:50] "GET /admin/ HTTP/1.1" 302 0
[19/Aug/2025 01:34:50] "GET /admin/login/?next=/admin/ HTTP/1.1"
200 4173
Forbidden (CSRF token missing.): /register_user/
[19/Aug/2025 01:35:16] "POST /register_user/ HTTP/1.1" 403 2491
Forbidden (CSRF token missing.): /register_user/
[19/Aug/2025 01:36:40] "POST /register_user/?
csrftoken=FpgH1qmv587QQvtlU57tvhS1LvpNhq66 HTTP/1.1" 403
2491
Forbidden (CSRF token missing.): /register_user/
[19/Aug/2025 01:36:48] "POST /register_user/ HTTP/1.1" 403 2491
C:\Users\10711484\Documents\Python Projects\Django backend Mini
Projects\new_django_api\AnjaliBlogApp\views.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\10711484\AppData\Local\Programs\Python\
Python310\lib\threading.py", line 1009, in _bootstrap_inner
self.run()
File "C:\Users\10711484\AppData\Local\Programs\Python\
Python310\lib\threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\core\management\commands\runserver.py", line 134, in
inner_run
self.check(**check_kwargs)
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\core\management\base.py", line 492, in check
all_issues = checks.run_checks(
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\core\checks\registry.py", line 89, in run_checks
new_errors = check(app_configs=app_configs,
databases=databases)
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\core\checks\urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\core\checks\urls.py", line 26, in check_resolver
return check_method()
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\urls\resolvers.py", line 531, in check
for pattern in self.url_patterns:
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\utils\functional.py", line 47, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\urls\resolvers.py", line 718, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns",
self.urlconf_module)
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\utils\functional.py", line 47, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\urls\resolvers.py", line 711, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Users\10711484\AppData\Local\Programs\Python\
Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in
_find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in
exec_module
File "<frozen importlib._bootstrap>", line 241, in
_call_with_frames_removed
File "C:\Users\10711484\Documents\Python Projects\Django
backend Mini Projects\new_django_api\new_django_api\urls.py", line
22, in <module>
path('', include('AnjaliBlogApp.urls')), # Include the app's URLs
File "C:\Users\10711484\Envs\rest_api_env\lib\site-packages\
django\urls\conf.py", line 39, in include
urlconf_module = import_module(urlconf_module)
File "C:\Users\10711484\AppData\Local\Programs\Python\
Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in
_find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in
exec_module
File "<frozen importlib._bootstrap>", line 241, in
_call_with_frames_removed
File "C:\Users\10711484\Documents\Python Projects\Django
backend Mini Projects\new_django_api\AnjaliBlogApp\urls.py", line 2,
in <module>
from . import views
File "C:\Users\10711484\Documents\Python Projects\Django
backend Mini Projects\new_django_api\AnjaliBlogApp\views.py", line
9, in <module>
@csrf_exempt # Use this if you want to disable CSRF protection
for this view
NameError: name 'csrf_exempt' is not defined
C:\Users\10711484\Documents\Python Projects\Django backend Mini
Projects\new_django_api\AnjaliBlogApp\views.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 19, 2025 - 01:50:26
Django version 5.2.5, using settings 'new_django_api.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
WARNING: This is a development server. Do not use it in a
production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see:
https://docs.djangoproject.com/en/5.2/howto/deployment/
[19/Aug/2025 01:50:32] "POST /register_user/ HTTP/1.1" 201 92
[19/Aug/2025 01:52:36] "GET /admin HTTP/1.1" 301 0
[19/Aug/2025 01:52:36] "GET /admin/ HTTP/1.1" 200 7074
[19/Aug/2025 01:52:45] "GET /admin/AnjaliBlogApp/customuser/
HTTP/1.1" 200 12088
[19/Aug/2025 01:52:45] "GET /admin/jsi18n/ HTTP/1.1" 200 3342
[19/Aug/2025 01:52:45] "GET /static/admin/img/icon-no.svg
HTTP/1.1" 200 560
3. Extending Simple JWT Access Token Expiry
Project Configuration :
Then, your django project must be configured to use the library.
In settings.py,
add rest_framework_simplejwt.authentication.JWTAuthentication to
the list of authentication classes:
REST_FRAMEWORK = {
...
'DEFAULT_AUTHENTICATION_CLASSES': (
...
'rest_framework_simplejwt.authentication.JWTAuthentication',
)
...
}
Also, in your root urls.py file (or any other url config), include routes
for Simple JWT’s TokenObtainPairView and TokenRefreshView views:
from rest_framework_simplejwt.views import (
TokenObtainPairView,
TokenRefreshView,
)
urlpatterns = [
...
path('api/token/', TokenObtainPairView.as_view(),
name='token_obtain_pair'),
path('api/token/refresh/', TokenRefreshView.as_view(),
name='token_refresh'),
...
]
4. Testing Blog Creation Endpoint/model in Postman
by ‘Create_Blog ‘ Model Added in model.py
(rest_api_env) PS C:\Users\10711484\Documents\Python
Projects\Django backend Mini Projects\new_django_api>
python manage.py migrate
Operations to perform:
Apply all migrations: AnjaliBlogApp, admin, auth, contenttypes,
sessions
+ Create model Blog
(rest_api_env) PS C:\Users\10711484\Documents\Python Projects\
Django backend Mini Projects\new_django_api> python manage.py
migrate
Operations to perform:
Apply all migrations: AnjaliBlogApp, admin, auth, contenttypes,
sessions
e
Operations to perform:
Apply all migrations: AnjaliBlogApp, admin, auth, contenttypes,
sessions
Operations to perform:
Apply all migrations: AnjaliBlogApp, admin, auth, contenttypes,
sessions
Apply all migrations: AnjaliBlogApp, admin, auth, contenttypes,
sessions
Running migrations:
Applying AnjaliBlogApp.0002_blog... OK
ects\new_django_api>
[19/Aug/2025 22:38:51] "POST /create_blog/ HTTP/1.1" 500 152343
C:\Users\10711484\Documents\Python Projects\Django backend Mini
Projects\new_django_api\AnjaliBlogApp\models.py changed,
reloading.
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 19, 2025 - 22:40:42
Django version 5.2.5, using settings 'new_django_api.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
WARNING: This is a development server. Do not use it in a
production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see:
https://docs.djangoproject.com/en/5.2/howto/deployment/
[19/Aug/2025 22:40:57] "POST /create_blog/ HTTP/1.1" 201
281
[19/Aug/2025 22:42:30] "GET /admin/AnjaliBlogApp/blog/
HTTP/1.1" 200 12400
[19/Aug/2025 22:42:30] "GET /admin/jsi18n/ HTTP/1.1" 200 3342
[19/Aug/2025 22:42:43] "GET /admin/AnjaliBlogApp/blog/1/change/
HTTP/1.1" 200 16488
[19/Aug/2025 22:42:43] "GET /static/admin/css/forms.css HTTP/1.1"
304 0
[19/Aug/2025 22:42:43] "GET /static/admin/js/calendar.js HTTP/1.1"
304 0
[19/Aug/2025 22:42:43] "GET
/static/admin/js/admin/DateTimeShortcuts.js HTTP/1.1" 304 0
[19/Aug/2025 22:42:43] "GET /static/admin/js/prepopulate_init.js
HTTP/1.1" 304 0
[19/Aug/2025 22:42:43] "GET /static/admin/css/widgets.css
HTTP/1.1" 304 0
[19/Aug/2025 22:42:43] "GET /admin/jsi18n/ HTTP/1.1" 200 3342
[19/Aug/2025 22:42:43] "GET /static/admin/js/change_form.js
HTTP/1.1" 304 0
[19/Aug/2025 22:42:43] "GET /static/admin/img/icon-deletelink.svg
HTTP/1.1" 200 392
[19/Aug/2025 22:42:43] "GET /static/admin/img/icon-calendar.svg
HTTP/1.1" 304 0
[19/Aug/2025 22:42:43] "GET /static/admin/img/icon-clock.svg
HTTP/1.1" 304 0
[19/Aug/2025 22:43:03] "GET /admin/AnjaliBlogApp/blog/ HTTP/1.1"
200 12400
[19/Aug/2025 22:43:03] "GET /admin/jsi18n/ HTTP/1.1" 200 3342
[19/Aug/2025 22:43:07] "GET /admin/ HTTP/1.1" 200 7689
Not Found: /
[19/Aug/2025 22:43:15] "GET / HTTP/1.1" 404 3220
[19/Aug/2025 22:43:19] "GET /admin/ HTTP/1.1" 200 7689
[19/Aug/2025 22:43:22] "GET /admin/AnjaliBlogApp/blog/ HTTP/1.1"
200 12400
[19/Aug/2025 22:43:22] "GET /admin/jsi18n/ HTTP/1.1" 200 3342
Case 1 : Is_draft = false, published date will be current
date&time
Case 2: Is_draft = True, published_date will be null.
5. Implementing Blog Listing Functionality
(rest_api_env) C:\Users\10711484\Documents\Python Projects\
Django backend Mini Projects\new_django_api>python manage.py
runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 20, 2025 - 13:47:27
Django version 5.2.5, using settings 'new_django_api.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
WARNING: This is a development server. Do not use it in a production
setting. Use a production WSGI or ASGI server instead.
For more information on production servers see:
https://docs.djangoproject.com/en/5.2/howto/deployment/
[20/Aug/2025 13:59:18] "GET /admin/ HTTP/1.1" 200 7689
[20/Aug/2025 13:59:18] "GET /static/admin/css/dark_mode.css HTTP/1.1"
304 0
[20/Aug/2025 13:59:18] "GET /static/admin/css/nav_sidebar.css HTTP/1.1"
304 0
[20/Aug/2025 13:59:18] "GET /static/admin/css/dashboard.css HTTP/1.1"
304 0
[20/Aug/2025 13:59:18] "GET /static/admin/css/base.css HTTP/1.1" 304 0
[20/Aug/2025 13:59:18] "GET /static/admin/css/responsive.css HTTP/1.1"
304 0
[20/Aug/2025 13:59:18] "GET /static/admin/js/theme.js HTTP/1.1" 304 0
[20/Aug/2025 13:59:18] "GET /static/admin/js/nav_sidebar.js HTTP/1.1"
304 0
[20/Aug/2025 13:59:18] "GET /static/admin/img/icon-changelink.svg
HTTP/1.1" 304 0
[20/Aug/2025 13:59:18] "GET /static/admin/img/icon-addlink.svg
HTTP/1.1" 304 0
[20/Aug/2025 13:59:21] "GET /admin/AnjaliBlogApp/blog/ HTTP/1.1" 200
17449
[20/Aug/2025 13:59:21] "GET /static/admin/js/core.js HTTP/1.1" 304 0
[20/Aug/2025 13:59:21] "GET /static/admin/css/changelists.css HTTP/1.1"
304 0
[20/Aug/2025 13:59:21] "GET /static/admin/js/vendor/jquery/jquery.js
HTTP/1.1" 304 0
[20/Aug/2025 13:59:21] "GET
/static/admin/js/admin/RelatedObjectLookups.js HTTP/1.1" 304 0
[20/Aug/2025 13:59:21] "GET /static/admin/js/jquery.init.js HTTP/1.1" 304
0
[20/Aug/2025 13:59:21] "GET /static/admin/js/actions.js HTTP/1.1" 304 0
[20/Aug/2025 13:59:21] "GET /static/admin/img/search.svg HTTP/1.1" 304
0
[20/Aug/2025 13:59:21] "GET /static/admin/js/vendor/xregexp/xregexp.js
HTTP/1.1" 304 0
[20/Aug/2025 13:59:21] "GET /static/admin/js/prepopulate.js HTTP/1.1"
304 0
[20/Aug/2025 13:59:21] "GET /static/admin/js/urlify.js HTTP/1.1" 304 0
[20/Aug/2025 13:59:21] "GET /static/admin/img/icon-no.svg HTTP/1.1" 304
0
[20/Aug/2025 13:59:21] "GET /admin/jsi18n/ HTTP/1.1" 200 3342
[20/Aug/2025 13:59:21] "GET /static/admin/js/filters.js HTTP/1.1" 304 0
[20/Aug/2025 13:59:21] "GET /static/admin/img/icon-yes.svg HTTP/1.1"
304 0
[20/Aug/2025 13:59:21] "GET /static/admin/img/tooltag-add.svg HTTP/1.1"
304 0
[20/Aug/2025 13:59:21] "GET /static/admin/img/icon-viewlink.svg
HTTP/1.1" 304 0
[20/Aug/2025 14:00:08] "GET /list_blogs HTTP/1.1" 301 0
[20/Aug/2025 14:00:08] "GET /list_blogs/ HTTP/1.1" 200 14770
[20/Aug/2025 14:00:08] "GET /static/rest_framework/css/prettify.css
HTTP/1.1" 200 817
[20/Aug/2025 14:00:08] "GET /static/rest_framework/css/default.css
HTTP/1.1" 200 1152
[20/Aug/2025 14:00:08] "GET /static/rest_framework/js/csrf.js HTTP/1.1"
200 1793
[20/Aug/2025 14:00:08] "GET /static/rest_framework/js/ajax-form.js
HTTP/1.1" 200 3796
[20/Aug/2025 14:00:08] "GET /static/rest_framework/css/bootstrap-
tweaks.css HTTP/1.1" 200 3426
[20/Aug/2025 14:00:08] "GET /static/rest_framework/js/prettify-min.js
HTTP/1.1" 200 13632
[20/Aug/2025 14:00:08] "GET /static/rest_framework/js/bootstrap.min.js
HTTP/1.1" 200 39680
[20/Aug/2025 14:00:08] "GET /static/rest_framework/css/bootstrap.min.css
HTTP/1.1" 200 121457
[20/Aug/2025 14:00:08] "GET /static/rest_framework/js/default.js
HTTP/1.1" 200 1268
[20/Aug/2025 14:00:08] "GET /static/rest_framework/js/load-ajax-form.js
HTTP/1.1" 200 59
[20/Aug/2025 14:00:08] "GET /static/rest_framework/js/jquery-3.7.1.min.js
HTTP/1.1" 200 87533
[20/Aug/2025 14:00:08] "GET /static/rest_framework/img/grid.png
HTTP/1.1" 200 1458
[20/Aug/2025 14:01:11] "GET /list_blogs/?format=json HTTP/1.1" 200 4991
[20/Aug/2025 14:01:22] "OPTIONS /list_blogs/ HTTP/1.1" 200 5493
[20/Aug/2025 14:01:24] "OPTIONS /list_blogs/ HTTP/1.1" 200 5493
[20/Aug/2025 14:01:25] "OPTIONS /list_blogs/ HTTP/1.1" 200 5493
[20/Aug/2025 14:01:30] "GET /list_blogs/?format=api HTTP/1.1" 200
14814
[20/Aug/2025 14:02:23] "OPTIONS /list_blogs/?format=api HTTP/1.1" 200
5537
[20/Aug/2025 14:02:28] "GET /list_blogs/ HTTP/1.1" 200 14770
6. Enabling Blog Updates via API
(rest_api_env) C:\Users\10711484\Documents\Python Projects\
Django backend Mini Projects\new_django_api>python manage.py
runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 20, 2025 - 15:46:50
Django version 5.2.5, using settings 'new_django_api.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
WARNING: This is a development server. Do not use it in a
production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see:
https://docs.djangoproject.com/en/5.2/howto/deployment/
Forbidden: /update_blog/10/
[20/Aug/2025 15:46:57] "PUT /update_blog/10/ HTTP/1.1" 403 95
Unauthorized: /update_blog/10/
[20/Aug/2025 15:49:26] "PUT /update_blog/10/ HTTP/1.1" 401 58
[20/Aug/2025 15:51:58] "POST /token/ HTTP/1.1" 200 489
[20/Aug/2025 15:53:47] "PUT /update_blog/10/ HTTP/1.1" 200 1941
Case1: If user have not logged-in, authentication credentials
needed to proceed further
Case 2 : When another user trying to update the blog of
another author -
Case 3 : When the author is trying to update his own blog by
providing primary key of blog as– /update_blog/10/
From this :
To this :
7. Implementing Blog Deletion Feature
Only author can delete the blog :
Any other user try to delete somebody else blog :
8. Updating User Profiles via API
9. Deploying the Django REST API to Production
1. In setting.PY
# for production deployment, you might want to set
STATIC_ROOT
STATIC_ROOT = BASE_DIR / 'static'
2. In Url.py
urlpatterns += static(settings.STATIC_URL,
document_root=settings.STATIC_ROOT)
3. > pip install gunicorn
4. Create build.sh in path “new_django_api” base directory
#!usr/bin/env bash
pip install -r requirements.txt
python manage.py collectstatic --noinput
python manage.py migrate
# If you want to run tests, uncomment the following line
# python manage.py test
echo "Build completed successfully."
5. Create git repository and upload code into it.
6. Using render.com, deploy it through gunicorn :-
https://anjali-blog-app.onrender.com
7. ==> Cloning from https://github.com/guptanjali16/Anjali-Blog-App
8. ==> Checking out commit de9a7463bb652ca97ceac7bdd035eb286817617f in
branch main
9. ==> Downloading cache...
10. ==> Transferred 90MB in 7s. Extraction took 2s.
11. ==> Using Python version 3.13.4 (default)
12. ==> Docs on specifying a Python version:
https://render.com/docs/python-version
13. ==> Using Poetry version 2.1.3 (default)
14. ==> Docs on specifying a Poetry version:
https://render.com/docs/poetry-version
15. ==> Running build command 'sh build.sh'...
16. Collecting asgiref==3.9.1 (from -r requirements.txt (line 1))
17. Using cached asgiref-3.9.1-py3-none-any.whl.metadata (9.3 kB)
18. Collecting Django==5.2.5 (from -r requirements.txt (line 2))
19. Using cached django-5.2.5-py3-none-any.whl.metadata (4.1 kB)
20. Collecting djangorestframework==3.16.1 (from -r requirements.txt (line
3))
21. Using cached djangorestframework-3.16.1-py3-none-any.whl.metadata (11
kB)
22. Collecting djangorestframework_simplejwt==5.5.1 (from -r
requirements.txt (line 4))
23. Using cached djangorestframework_simplejwt-5.5.1-py3-none-
any.whl.metadata (4.6 kB)
24. Collecting gunicorn==23.0.0 (from -r requirements.txt (line 5))
25. Using cached gunicorn-23.0.0-py3-none-any.whl.metadata (4.4 kB)
26. Collecting packaging==25.0 (from -r requirements.txt (line 6))
27. Using cached packaging-25.0-py3-none-any.whl.metadata (3.3 kB)
28. Collecting pillow==11.3.0 (from -r requirements.txt (line 7))
29. Using cached pillow-11.3.0-cp313-cp313-
manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (9.0 kB)
30. Collecting PyJWT==2.10.1 (from -r requirements.txt (line 8))
31. Using cached PyJWT-2.10.1-py3-none-any.whl.metadata (4.0 kB)
32. Collecting sqlparse==0.5.3 (from -r requirements.txt (line 9))
33. Using cached sqlparse-0.5.3-py3-none-any.whl.metadata (3.9 kB)
34. Collecting typing_extensions==4.14.1 (from -r requirements.txt (line
10))
35. Using cached typing_extensions-4.14.1-py3-none-any.whl.metadata (3.0
kB)
36. Collecting tzdata==2025.2 (from -r requirements.txt (line 11))
37. Using cached tzdata-2025.2-py2.py3-none-any.whl.metadata (1.4 kB)
38. Using cached asgiref-3.9.1-py3-none-any.whl (23 kB)
39. Using cached django-5.2.5-py3-none-any.whl (8.3 MB)
40. Using cached djangorestframework-3.16.1-py3-none-any.whl (1.1 MB)
41. Using cached djangorestframework_simplejwt-5.5.1-py3-none-any.whl (107
kB)
42. Using cached gunicorn-23.0.0-py3-none-any.whl (85 kB)
43. Using cached packaging-25.0-py3-none-any.whl (66 kB)
44. Using cached pillow-11.3.0-cp313-cp313-
manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.6 MB)
45. Using cached PyJWT-2.10.1-py3-none-any.whl (22 kB)
46. Using cached sqlparse-0.5.3-py3-none-any.whl (44 kB)
47. Using cached typing_extensions-4.14.1-py3-none-any.whl (43 kB)
48. Using cached tzdata-2025.2-py2.py3-none-any.whl (347 kB)
49. Installing collected packages: tzdata, typing_extensions, sqlparse,
PyJWT, pillow, packaging, asgiref, gunicorn, Django,
djangorestframework, djangorestframework_simplejwt
50. Successfully installed Django-5.2.5 PyJWT-2.10.1 asgiref-3.9.1
djangorestframework-3.16.1 djangorestframework_simplejwt-5.5.1
gunicorn-23.0.0 packaging-25.0 pillow-11.3.0 sqlparse-0.5.3
typing_extensions-4.14.1 tzdata-2025.2
51. [notice] A new release of pip is available: 25.1.1 -> 25.2
52. [notice] To update, run: pip install --upgrade pip
53. 163 static files copied to '/opt/render/project/src/static'.
54. Operations to perform:
55. Apply all migrations: AnjaliBlogApp, admin, auth, contenttypes,
sessions
56. Running migrations:
57. No migrations to apply.
58. Your models in app(s): 'AnjaliBlogApp' have changes that are not yet
reflected in a migration, and so won't be applied.
59. Run 'manage.py makemigrations' to make new migrations, and then re-run
'manage.py migrate' to apply them.
60. Build completed successfully.
61. ==> Uploading build...
62. ==> Uploaded in 4.6s. Compression took 2.1s
63. ==> Build successful