Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DjangoTutorial/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'post',
]

Expand Down
4 changes: 3 additions & 1 deletion DjangoTutorial/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""

from django.contrib import admin
from django.urls import path
from django.urls import include, path

urlpatterns = [
path('admin/', admin.site.urls),
path('post/', include('post.urls')),
]
17 changes: 16 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions post/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.urls import path

from post.views import hello_world

urlpatterns = [
path('hello/', hello_world),
]
6 changes: 4 additions & 2 deletions post/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from django.shortcuts import render
from django.http import JsonResponse

# Create your views here.

def hello_world(request):
return JsonResponse({'message': 'Hello, world!'})
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ readme = "README.md"
[tool.poetry.dependencies]
python = "^3.10"
django = "^4.2"
djangorestframework = "^3.15.1"

[tool.poetry.group.dev.dependencies]
pre-commit = "^3.3.3"
Expand Down