Guest User

Django application, cycle error

a guest
May 16th, 2024
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.14 KB | Source Code | 0 0
  1. base - urls.py:
  2.  
  3. '''
  4. from django.urls import path
  5. from . import views
  6.    
  7. urlpatterns = [
  8.    path('', views.home)
  9. ]
  10. '''
  11.  
  12. base - views.py
  13.  
  14. '''
  15. from django.shortcuts import render
  16.  
  17. # Create your views here.
  18.  
  19. def home(request):
  20.    return render(request, 'base/home.html')
  21. '''
  22.  
  23. mywebsite - urls.py:
  24.  
  25. '''
  26.  
  27. """
  28. URL configuration for mywebsite project.
  29.  
  30. The `urlpatterns` list routes URLs to views. For more information please see:
  31.    https://docs.djangoproject.com/en/5.0/topics/http/urls/
  32. Examples:
  33. Function views
  34.    1. Add an import:  from my_app import views
  35.    2. Add a URL to urlpatterns:  path('', views.home, name='home')
  36. Class-based views
  37.    1. Add an import:  from other_app.views import Home
  38.    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
  39. Including another URLconf
  40.    1. Import the include() function: from django.urls import include, path
  41.    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
  42. """
  43. from django.contrib import admin
  44. from django.urls import path, include
  45.  
  46. urlpatterns = [
  47.    path('admin/', admin.site.urls),
  48.    path('', include('base.urls'))
  49. ]
  50.  
  51. '''
Tags: django
Advertisement
Add Comment
Please, Sign In to add comment