I have a problem with a test that I have to submit to a selective process that I am performing. I've tried every possible and imaginable way but I could not. When trying to call an index.html file that is inside a templates / api folder so that it becomes the root of the url ( link ) django does not recognize it. Here are codes:
File urls.py from my sisquestoes folder (root, folder that has setings.py): PS: I already changed the name of this api and still can not locate the template.
urlpatterns = [
path(r'admin/', admin.site.urls),
path('', include('api.urls')),
url(r'^', include('api.urls','app_name')),
]
The urls.py file in the api folder (which has the admin.py folder and the files and templates / api / index.html):
router = routers.DefaultRouter()
router.register('questoes', views.QuestoesView)
router.register('user', views.UserView)
app_name="api"
urlpatterns = [
path('', include(router.urls)),
url(r'^$', views.index, name='index'),
]
Function in views.py:
from django.shortcuts import render
from . import views
def index(request):
return render(request,'api/index.html')
I honestly spent the whole dawn trying to solve read almost all the documentation, I went through various paths and tutorials and nothing. I look forward to some kind and caring soul. Big hug.