Movendo as function based views para o arquivo views.py dos novos apps no Django

This commit is contained in:
Luiz Otávio
2023-04-16 14:33:08 -03:00
parent 07107c13aa
commit 4d721daa8d
3 changed files with 18 additions and 18 deletions

View File

@@ -1,3 +1,8 @@
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
# from django.shortcuts import render
def blog(request):
print('blog')
return HttpResponse('blog do app')

View File

@@ -1,3 +1,8 @@
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
# from django.shortcuts import render
def home(request):
print('home')
return HttpResponse('home do app')

View File

@@ -14,23 +14,13 @@ 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 blog import views as blog_views
from django.contrib import admin
from django.http import HttpResponse
from django.urls import path
def home(request):
print('home')
return HttpResponse('home1')
def blog(request):
print('blog')
return HttpResponse('blog')
from home import views as home_views
urlpatterns = [
path('', home),
path('blog/', blog),
path('', home_views.home),
path('blog/', blog_views.blog),
path('admin/', admin.site.urls),
]