Skip to content

Commit 3213041

Browse files
committed
Commit message:
Add 'music' app to Django project Added new 'music' app to Django project along with necessary views and urls. Settings and main url files have been updated to include 'music' app. A base index view returning a simple HttpResponse has been added to 'music' views for testing purposes.
1 parent f2a1ab5 commit 3213041

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

first_api/first_api/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"django.contrib.messages",
3939
"django.contrib.staticfiles",
4040
"rest_framework",
41+
"music",
4142
]
4243

4344
MIDDLEWARE = [

first_api/first_api/urls.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
"""
1717

1818
from django.contrib import admin
19-
from django.urls import path
19+
from django.urls import path, include
2020

2121
urlpatterns = [
2222
path("admin/", admin.site.urls),
23+
path("", include('music.urls')),
2324
]

first_api/music/urls.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from django.urls import path
2+
3+
from . import views
4+
5+
urlpatterns = [
6+
path('', views.index, name='index')
7+
]

first_api/music/views.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
from django.shortcuts import render
1+
from django.http import HttpResponse
22

3-
# Create your views here.
3+
4+
def index(_request):
5+
return HttpResponse("My first API!")

0 commit comments

Comments
 (0)