Answer the question
In order to leave comments, you need to log in
How to pass a function from views to urlpatterns?
I am using django version 1.10. We need this function from views.py:
from django.http import HttpResponse
from django.shortcuts import render
def post_home(request):
return HttpResponse("<h1>Hi</h1>")
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^posts/$', "НАДО СУДА ПЕРЕДАТЬ ФУНКЦИЮ"),
]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question