Skip to content

Commit

Permalink
Define primeira rota
Browse files Browse the repository at this point in the history
  • Loading branch information
brnocesar committed Nov 6, 2020
1 parent 3657009 commit 3d58da1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
6 changes: 6 additions & 0 deletions apps/receitas/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.urls import path
from . import views

urlpatterns = [
path('', views.index, name='index')
]
4 changes: 3 additions & 1 deletion apps/receitas/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from django.shortcuts import render
from django.http import HttpResponse

# Create your views here.
def index(request):
return HttpResponse('<h1>Hello Receitas</h1>')
20 changes: 4 additions & 16 deletions djangoreceitas/urls.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
"""djangoreceitas URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/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 django.urls import path, include

print(include('apps.receitas.urls'))

urlpatterns = [
path('', include('apps.receitas.urls')),
path('admin/', admin.site.urls),
]

0 comments on commit 3d58da1

Please sign in to comment.