First Simple Program
After register the app in setting go urls.py file and give the address of views by typing following code,
I write code say hi
First import the views where I declare the method simple so I am calling from urls.py
Let’s see the views.py page
First import module render import for the return html file it’s discussed latter.
Second module httpresponse used to return the hello world message, further makes the function simple and it returns the message “Hello, World”
Run this code you will see following output
Let’s talk about the html file if any project html file how we will run the project.
Create folder “templates” in app and keep html file in this folder and modified code in views.
Before start briefly we will see “Render Function”
Render Function: its takes the 3 Parameter which are follows:
- Request : invokes for request.
- Path to the templates:
- Dictionary of parameters:
urls.py: we write following code in urls.py
veiws.py : in this file we return the html file name abc.html returns.
abc.html : it is consist the basic message file