From 3213041e6d0fd5e3bfbfc372ec5c1aa719ade757 Mon Sep 17 00:00:00 2001 From: FeliPython Date: Thu, 18 Apr 2024 10:15:12 -0300 Subject: [PATCH] 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. --- first_api/first_api/settings.py | 1 + first_api/first_api/urls.py | 3 ++- first_api/music/urls.py | 7 +++++++ first_api/music/views.py | 6 ++++-- 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 first_api/music/urls.py diff --git a/first_api/first_api/settings.py b/first_api/first_api/settings.py index 4c32de7..d21794d 100644 --- a/first_api/first_api/settings.py +++ b/first_api/first_api/settings.py @@ -38,6 +38,7 @@ "django.contrib.messages", "django.contrib.staticfiles", "rest_framework", + "music", ] MIDDLEWARE = [ diff --git a/first_api/first_api/urls.py b/first_api/first_api/urls.py index 2924dda..8f513f1 100644 --- a/first_api/first_api/urls.py +++ b/first_api/first_api/urls.py @@ -16,8 +16,9 @@ """ from django.contrib import admin -from django.urls import path +from django.urls import path, include urlpatterns = [ path("admin/", admin.site.urls), + path("", include('music.urls')), ] diff --git a/first_api/music/urls.py b/first_api/music/urls.py new file mode 100644 index 0000000..2fcca0d --- /dev/null +++ b/first_api/music/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path('', views.index, name='index') +] diff --git a/first_api/music/views.py b/first_api/music/views.py index 91ea44a..f84a524 100644 --- a/first_api/music/views.py +++ b/first_api/music/views.py @@ -1,3 +1,5 @@ -from django.shortcuts import render +from django.http import HttpResponse -# Create your views here. + +def index(_request): + return HttpResponse("My first API!")