How & Where are Django View Functions Called?

36 views
Skip to first unread message

Alejandro Reyes

unread,
Jan 9, 2019, 10:36:51 PM1/9/19
to Django users
Hi,

Suppose I have a standard views.py module in my Django app and that app has a simple function:

def home(request):
   form
=request.POST['form']


Where exactly in the Django framework does it specifically call 'home' with the correctly typed parameter 'request'? I want to know this for Static Code Analysis purposes. Thanks.

Lachlan Musicman

unread,
Jan 9, 2019, 10:42:12 PM1/9/19
to django...@googlegroups.com
When you define your URLs. Each URL, when visited, has a view it triggers. Hence the URL syntax

Cheers
L.


--
------
"The fact that you're still saying something like 'feminism gone mad' suggests that feminism hasn't gone mad ENOUGH yet."

Helen Zaltzman / @HelenZaltzman
https://twitter.com/HelenZaltzman/status/1065384934846545920

Jason

unread,
Jan 10, 2019, 8:16:22 AM1/10/19
to Django users
Check out https://www.youtube.com/watch?v=Lwp73bSaplo for a nice explaination of how the request response cycle works

abel otugeme

unread,
Jan 10, 2019, 11:41:58 AM1/10/19
to django...@googlegroups.com

Ones your view matches your use patterns it gets called and run anytime you try access the site

Vivek Jha

unread,
Jan 10, 2019, 1:21:09 PM1/10/19
to django...@googlegroups.com
you have to call in urls.py 

from django.urls import path
projectname.appname.views import home

url patterns=[
                  path('home/',home),


On Thu, Jan 10, 2019 at 10:11 PM abel otugeme <aotu...@gmail.com> wrote:

Ones your view matches your use patterns it gets called and run anytime you try access the site

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMrS0S8J6VwHTqfDiWNN250JAU%2BCwqhJsNUdCdP5ni%3Dyj%3DYkEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Amitesh Sahay

unread,
Jan 11, 2019, 3:44:28 AM1/11/19
to django...@googlegroups.com
models.py, urls.py

Regards,
Amitesh Sahay
91-750 797 8619


Reply all
Reply to author
Forward
0 new messages