diff --git a/trydjango/src/pages/views.py b/trydjango/src/pages/views.py new file mode 100644 index 00000000000..268afd1fd98 --- /dev/null +++ b/trydjango/src/pages/views.py @@ -0,0 +1,6 @@ +from django.shortcuts import render + +from django.http import HttpResponse + +def home_view(*args, **kwargs): + return HttpResponse("

Hello World

") \ No newline at end of file diff --git a/trydjango/src/trydjango/urls.py b/trydjango/src/trydjango/urls.py new file mode 100644 index 00000000000..acf2f7561ed --- /dev/null +++ b/trydjango/src/trydjango/urls.py @@ -0,0 +1,26 @@ +""" +URL configuration for trydjango project. + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/6.0/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 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 pages.views import home_view + +urlpatterns = [ + path('', home_view, name='home'), + path("admin/", admin.site.urls), +]