摘要:While you're editingsettings.py, take note of the INSTALLED_APPSsetting towards the bottom of the file. That variable holds the names of all Django applications that are activated in this Django insta...
阅读全文
摘要:Django comes with a robust cache system that lets you save dynamic pages so they don’thave to be calculated for each request. For convenience, Django offers different levels of cachegranularity:...
阅读全文
摘要:The session and authorization system is a lot to absorb. Most of the time, you won’t needall the features described in this chapter, but when you need to allow complex interactionsbetween users,...
阅读全文
摘要:Django has convenient built-in tools that you can use to produce some common non-HTML content: • RSS/Atom syndication feeds • Sitemaps (an XML format originally developed by Google that ...
阅读全文
摘要:This chapter covers the last essential step of building a Django application: deploying it toa production server. If you’ve been following along with our ongoing examples, you probably used the...
阅读全文
摘要:Django ships with generic views to do the following: • Perform common “simple” tasks: redirect to a different page or render a giventemplate. • Display list and detail pages ...
阅读全文
摘要:In short, a model’s manager is an object through which Django models perform databasequeries. Each Django model has at least one manager, and you can create custom managers tocustomize database ...
阅读全文
摘要:Practice1: Write a custom tagPractice2: Write a custom filter
阅读全文
摘要:In Python regular expressions, the syntax for named regular expression groups is(?P<name>pattern), where name is the name of the group and pattern is some pattern to match. If you put a single ...
阅读全文
摘要:Django comes with a form library, called django.forms, that handles many of the issues we’vebeen exploring in this chapter—from HTML form display to validation. Let’s dive in andrewo...
阅读全文
摘要:admin.pyCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--1fromdjango.contribimportadmin2frommysite.books.modelsimportPublisher,Author,Book34classAuthor...
阅读全文
摘要:What’s the difference between a project and an app?The difference is that of configuration vs. code: • A project is an instance of a certain set of Django apps, plus the configuration for...
阅读全文
摘要:Template:[代码]View:[代码]Settings:settings.pyCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--1TEMPLATE_DIRS=(2'/django/mysite/templates',3#Putstringshere...
阅读全文
摘要:views.pyCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--1fromdjango.httpimportHttpResponse,Http4042importdatetime34defhello(request):5returnHttpRespon...
阅读全文
摘要:Django only supports python 2.4 to python 2.6. If you run "python setup.py install" with python 3.0+ installed, you will get error like "u'SVN' syntax error". After running "django-admin.py startpro...
阅读全文
摘要:Django is a web framework.Why I want to learn Django? Because I want to practice my python skills.
阅读全文