Hello Django

Do you remember the first time you use the programming language print "hello world" what time is it? Next we will print a "hello Django" on the WEB page, open our Django development journey!

1. Before creating a good sign applications added to the project (Configuration guest / settings.py)

 

 2. Add route (Configuration guest / urls.py)

 

  3. Create index function, add content (configuration ../sign/views.py) on the page to be displayed in the function

 

 

 

 

 4. Restart project services, visit url http://127.0.0.1:8000/index/ see page browsing effect

 

 

 Hey, there are no pages that point too simple, not so beautiful, and then the next page, right next to beautify our

 

 5. Use the page template landscaping

Create a directory templates / index.html under the sign directory (Django default html file search templates directory under)

 

 6. The index function in modified views.py

 

 7. Refresh the page look effect

 

 

Guess you like

Origin www.cnblogs.com/pipile/p/12620667.html