Movendo as function based views para o arquivo views.py dos novos apps no Django
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user