Book description
Delivers absolutely everything you will ever need to know to become a master Django programmer
About This Book
- Gain a complete understanding of Django - the most popular, Python-based web framework in the world
- Gain the skills to successfully designing, developing, and deploying your app
- This book is packaged with fully described code so you can learn the fundamentals and the advanced topics to get a complete understanding of all of Django's core functions
Who This Book Is For
This book assumes you have a basic understanding of the Internet and programming. Experience with Python or Django would be an advantage, but is not necessary. It is ideal for beginner to intermediate programmers looking for a fast, secure, scalable, and maintainable alternative web development platform to those based on PHP, Java, and dotNET.
What You Will Learn
- Use Django to access user-submitted form data, validate it, and work with it
- Get to know advanced URLconf tips and tricks
- Extend Django's template system with custom code
- Define models and use the database API to create, retrieve, update, and delete records
- Fully extend and customize the default implementation as per your project's needs
- Test and deploy your Django application
- Get to know more about Django's session, cache Framework, and middleware
In Detail
Mastering Django: Core is a completely revised and updated version of the original Django Book, written by Adrian Holovaty and Jacob Kaplan-Moss - the creators of Django.
The main goal of this book is to make you a Django expert. By reading this book, you'll learn the skills needed to develop powerful websites quickly, with code that is clean and easy to maintain.
This book is also a programmer's manual that provides complete coverage of the current Long Term Support (LTS) version of Django. For developers creating applications for commercial and business critical deployments, Mastering Django: Core provides a complete, up-to-date resource for Django 1.8LTS with a stable code-base, security fixes and support out to 2018.
Style and approach
This comprehensive step-by-step practical guide offers a thorough understanding of all the web development concepts related to Django. In addition to explaining the features of Django, this book provides real-world experience on how these features fit together to build extraordinary apps.
Table of contents
-
Mastering Django: Core
- Mastering Django: Core
- Credits
- About the Author
- www.PacktPub.com
- Preface
- 1. Introduction to Django and Getting Started
- 2. Views and URLconfs
- 3. Templates
- 4. Models
- 5. The Django Admin Site
-
6. Forms
- Getting data from the Request Object
- A simple form-handling example
- Improving our simple form-handling example
- Simple validation
- Making a contact form
- Tying form objects into views
- Changing how fields are rendered
- Setting a maximum length
- Setting initial values
- Custom validation rules
- Specifying labels
- Customizing form design
- What's next?
- 7. Advanced Views and URLconfs
-
8. Advanced Templates
- Template language review
- Requestcontext and context processors
- Guidelines for writing our own context processors
- Automatic HTML escaping
- Inside Template loading
- Extending the template system
- Custom template tags and filters
-
Advanced custom template tags
- A quick overview
- Writing the compilation function
- Writing the renderer
- Auto-escaping Considerations
- Thread-safety Considerations
- Registering the tag
- Passing template variables to The Tag
- Setting a variable in the context
- Parsing until another block tag
- Parsing until another block tag, and saving contents
- What's next
- 9. Advanced Models
- 10. Generic Views
-
11. User Authentication in Django
- Overview
- Using the Django authentication system
- User objects
- Permissions and authorization
- Authentication in web requests
- Authentication views
- Authenticating data in templates
- Managing users in the admin
- Password management in Django
- Customizing authentication in Django
- Custom permissions
- Extending the existing user model
- Substituting a custom user model
- What's next?
-
12. Testing in Django
- Introduction to testing
- Introducing automated testing
- Basic testing strategies
- Writing a test
- Creating a test
- Running tests
- Testing tools
- The test database
- Using different testing frameworks
- What's next?
-
13. Deploying Django
- Preparing your codebase for production
- Critical settings
- Environment-specific settings
- HTTPS
- Performance optimizations
- Error reporting
- Using a virtualenv
- Using different settings for production
- Deploying Django to a production server
- Deploying Django with Apache and mod_wsgi
- Serving static files in production
- Scaling
- Performance tuning
- What's next?
-
14. Generating Non-HTML Content
- The basics: views and MIME types
- Producing CSV
- Using the template system
- Other text-based formats
- Generating PDF
- Install ReportLab
- Write your view
- Complex PDF's
- Further resources
- Other possibilities
- The syndication feed framework
- The high-level framework
- The low-level framework
- The Sitemap framework
- What's next?
- 15. Django Sessions
- 16. Djangos Cache Framework
-
17. Django Middleware
- Activating middleware
- Hooks and application order
- Writing your own middleware
- Available middleware
- Middleware ordering
- What's next?
-
18. Internationalization
- Definitions
- Translation
- Internationalization: in Python code
- Internationalization: In template code
- Internationalization: In Javascript code
- Internationalization: In URL patterns
- Localization: How to create language files
- Explicitly setting the active language
- Using translations outside views and templates
- Implementation notes
- What's next?
-
19. Security in Django
-
Django's built in security features
- Cross Site Scripting (XSS) protection
- Cross Site Request Forgery (CSRF) protection
- SOL injection protection
- Clickjacking protection
- SSL/HTTPS
- Host header validation
- Session security
- Additional security tips
-
Django's built in security features
- 20. More on Installing Django
-
21. Advanced Database Management
- General notes
- postgreSQL notes
- MySQL notes
- SQLite notes
- Oracle notes
- Using a 3rd-Party database backend
- Integrating Django with a legacy database
- What's next?
- A. Model Definition Reference
-
B. Database API Reference
- Creating objects
- Saving changes to objects
-
Retrieving objects
- Retrieving all objects
- Retrieving specific objects with filters
- Filtered querysets are unique
- Retrieving a single object with get
- Other queryset methods
- Limiting querysets
- Field lookups
- Lookups that span relationships
- Filters can reference fields on the model
- The pk lookup shortcut
- Escaping percent signs and underscores in LIKE statements
- Caching and querysets
- Complex lookups with Q objects
- Comparing objects
- Deleting objects
- Copying model instances
- Updating multiple objects at once
- Related objects
- Falling back to raw SQL
- C. Generic View Reference
- D. Settings
-
E. Built-in Template Tags and Filters
- Built-in tags
-
Built-in filters
- add
- addslashes
- capfirst
- center
- cut
- date
- default
- default_if_none
- dictsort
- dictsortreversed
- divisibleby
- escape
- escapejs
- filesizeformat
- first
- floatformat
- get_digit
- iriencode
- join
- last
- length
- length_is
- linebreaks
- linebreaksbr
- linenumbers
- ljust
- lower
- make_list
- phone2numeric
- pluralize
- pprint
- random
- rjust
- safe
- safeseq
- slice
- slugify
- stringformat
- striptags
- time
- timesince
- timeuntil
- title
- truncatechars
- truncatechars_html
- truncatewords
- truncatewords_html
- unordered_list
- upper
- urlencode
- urlize
- urlizetrunc
- wordcount
- wordwrap
- yesno
- Internationalization tags and filters
- Other tags and filters libraries
- F. Request and Response Objects
- G. Developing Django with Visual Studio
Product information
- Title: Mastering Django: Core
- Author(s):
- Release date: December 2016
- Publisher(s): Packt Publishing
- ISBN: 9781787281141
You might also like
book
Django Unleashed
Django is an amazingly powerful system for creating modern, dynamic websites. But programming Django hasn’t always …
book
Django: Web Development with Python
From an idea to a prototype – a complete guide for web development with the Django …
book
Django RESTful Web Services
Design, build and test RESTful web services with the Django framework and Python About This Book …
video
Advanced Web Development in Python with Django
More than 8 Hours of Video Instruction Overview Advanced Web Development in Python with Django LiveLessons …