Django Girls Tutorial
(https://www.gitbook.com/book/djangogirls/djangogirls-tutorial/details)
This book is a Django tutorial created for DjangoGirls event.
Have you ever felt that the world is more and more about technology and you are somehow left behind? Have you ever wondered how to create a website but have never had enough motivation to start? Have you ever thought that the software world is too complicated for you to even try doing something on your own?
Well, we have good news for you! Programming is not as hard as it seems and we want to show you how fun it can be.
This tutorial will not magically turn you into a programmer. If you want to be good at it, you need months or even years of learning and practice. But we want to show you that programming or creating websites is not as complicated as it seems. We will try to explain different bits and pieces as well as we can, so you will not feel intimidated by technology.
We hope that we’ll be able to make you love technology as much as we do!
Once you’ve finished the tutorial, you will have a simple, working web application: your own blog. We will show you how to put it online, so others will see your work!
Download eBook PDF (PDF 4,635KB)
Table of Contents
Introduction
Installation
How the Internet works
Introduction to command line
Python installation
Code editor
Introduction to Python
What is Django?
Django installation
Your first Django project!
Django models
Django admin
Deploy!
Django urls
Django views – time to create!
Introduction to HTML
Django ORM (Querysets)
Dynamic data in templates
Django templates
CSS – make it pretty
Template extending
Extend your application
Django Forms
What’s next?
Django Girls Tutorial: Extensions
(https://djangogirls.gitbooks.io/django-girls-tutorial-extensions/content/)
This book contains additional tutorials you can do after you’re finished with Django Girls Tutorial.
Current tutorials are:
- Homework: add more to your website!
- Homework: secure your website
- Homework: create comment model
- Optional: PostgreSQL installation
Getting Started with Django
(http://www.gettingstartedwithdjango.com/)
“Getting Started with Django” (or GSWD) is a series of video-based lessons meant to take you from novice to competent, or maybe even beyond.
Each lesson will cover many facets and best practices of modern Django web development and will feature a video and a text transcript to follow along with. Every video is available for download or online streaming.
Greenfield, D.R. and Greenfield, A.R. (2015) Two Scoops of Django: Best Practices for Django 1.8, Third Edition, Two Scoops Press
Download eBook PDF (PDF 5,389KB)
Download Example Code (ZIP 216KB)
Companion Web Site: https://www.twoscoopspress.com/products/two-scoops-of-django-1-8
Two Scoops of Django: Best Practices For Django 1.8 is chock-full of even more material that will help you with your Django projects.
We’ll introduce you to various tips, tricks, patterns, code snippets, and techniques that we’ve picked up over the years. This book is an update and expansion of previous editions:
- Updated for Django 1.8 and changes in the Django ecosystem, with corrections and clarifications added thanks to the feedback of our readers and technical reviewers.
- Revised material on templates, consuming REST APIs, replacing core components of Django, and more.
- 85+ pages of new material on Jinja2, debugging, advanced query tools, data validation, testing, security, and more.
We have put thousands of hours into the third edition of the book, writing and revising its material to include significant improvements and new material based on feedback from previous editions.
Table of Contents
- Chapter 1: Coding Style
- Chapter 2: The Optimal Django Environment Setup
- Chapter 3: How To Lay Out Django Projects
- Chapter 4: Fundamentals of Django App Design
- Chapter 5: Settings and Requirements Files
- Chapter 6: Model Best Practices
- Chapter 7: Queries and the Database Layer
- Chapter 8: Function- and Class-Based Views
- Chapter 9: Best Practices for Function-Based Views
- Chapter 10: Best Practices for Class-Based Views
- Chapter 11: Form Fundamentals
- Chapter 12: Common Patterns for Forms
- Chapter 13: Templates: Best Practices
- Chapter 14: Template Tags and Filters
- Chapter 15: Django Templates and Jinja2
- Chapter 16: Building REST APIs
- Chapter 17: Consuming REST APIs
- Chapter 18: Tradeoffs of Replacing Core Components
- Chapter 19: Working With the Django Admin
- Chapter 20: Dealing with the User Model
- Chapter 21: Django’s Secret Sauce: Third-Party Packages
- Chapter 22: Testing Chapter of Doom!
- Chapter 23: Documentation: Be Obsessed
- Chapter 24: Finding and Reducing Bottlenecks
- Chapter 25: Asynchronous Task Queues
- Chapter 26: Security Best Practices
- Chapter 27: Logging: Tips and Tools
- Chapter 28: Signals: Use Cases and Avoidance Techniques
- Chapter 29: What About Those Random Utilities?
- Chapter 30: Deployment: Platforms as a Service
- Chapter 31: Deploying Django Projects
- Chapter 29: Identical Environments: The Holy Grail
- Chapter 32: Continuous Integration
- Chapter 33: The Art of Debugging
- Chapter 34: Where and How to Ask Django Questions
- Chapter 35: Closing Thoughts
- Appendix A: Packages Mentioned In This Book
- Appendix B: Troubleshooting
- Appendix C: Additional Resources
- Appendix D: Internationalization and Localization
- Appendix E: Settings Alternatives
- Appendix F: Working with Python 3
TaskBuster Django Tutorial
(http://www.marinamele.com/taskbuster-django-tutorial)
Part I – Working environment and start a Django Project
- Building your Working environment
- Install Django 1.8
- Working directory and Sublime Text
- Obey the Testing Goat
- Create a Django project
- Start a development server
- Virtual environments and requirements files
- Different settings.py for each enviroment
- Production settings.py – Debug False
- Django security and the Secret Key
- Initialize a Git repository and Commit
- Upload your project into Bitbucket
- Static Files Settings
- Templates Settings
- Initializr: HTML5 Boilerplate and Twitter Bootstrap
- Home Page with TDD – Tests first
- Home Page with TDD – Code next
- Commit again to your local repository and Bitbucket
Part IV – Template Inheritance, Website files and Testing with coverage
Part VI – Documenting the TaskBuster Django Boilerplate
Part VII.b – Install and Configure MySQL
- Install MySQL
- Create a MySQL Database
- Install the MySQL Django adapter, psycopg2
- Configure the Django Database Settings
- MySQL Workbench
Part VIII – User Authentication with a Google Account using Django Allauth
- Define what we expect and write a Test
- Install django-allauth
- Settings File
- Urls
- Database migrations
- Sites configuration
- Google App registration
- Allauth Django configuration
- Testing the user flow
Part VIII.b – User Authentication with Twitter using Django Allauth
Part IX – Model creation, OneToOne relations, signals and the Django Admin
- UML Diagram of the TaskManager app
- Create the TaskManager app
- Profile Model: OneToOne relationship with the User Model
- Django Signals: create a Profile instance when a new user is created
- The Django Admin for the Profile Model
Part X – Model creation, ForeignKey relations, testing and the Django Admin
- UML Diagram Revision
- The Project Model: Foreign Key Relationships and custom validators
- Tests for the Project Model
- Django Admin for the Project Model: custom list display and Model Inline
Percival, H. J. W. (2014) Test-Driven Development with Python, O’Reilly Media
Download eBook PDF (PDF 10,044KB)
Download Example Code (ZIP 344KB)
Companion Web Site: http://www.obeythetestinggoat.com/pages/book.html
Read book online for FREE: http://chimera.labs.oreilly.com/books/1234000000754/index.html
By taking you through the development of a real web application from beginning to end, this hands-on guide demonstrates the practical advantages of test-driven development (TDD) with Python. You’ll learn how to write and run tests before building each part of your app, and then develop the minimum amount of code required to pass those tests. The result? Clean code that works.
In the process, you’ll learn the basics of Django, Selenium, Git, jQuery, and Mock, along with current web development techniques. If you’re ready to take your Python skills to the next level, this book clearly demonstrates how TDD encourages simple designs and inspires confidence.
- Dive into the TDD workflow, including the unit test/code cycle and refactoring
- Use unit tests for classes and functions, and functional tests for user interactions within the browser
- Learn when and how to use mock objects, and the pros and cons of isolated vs. integrated tests
- Test and automate your deployments with a staging server
- Apply tests to the third-party plugins you integrate into your site
- Use a Continuous Integration environment to run your tests automatically
Test-Driven Development with Python focuses on web development, with some coverage of JavaScript (inescapable for any web programmer). This book uses a concrete example—the development of a website, from scratch—to teach the TDD metholology, and how it applies to web programming, from the basics of database integration and javascript, going via browser-automation tools like Selenium, to advanced (and trendy) topics like NoSQL, websockets and Async programming.
Obey the Testing Goat! – TDD for the Web, with Python, Selenium, Django, JavaScript and pals….
(http://www.obeythetestinggoat.com/pages/book.html)
“Test-Driven Web Development with Python” aims to teach TDD for web programming. It uses a concrete example — the development of a website, from scratch — to explain the TDD metholology and how it applies to building web applications. It covers the Selenium browser-automation tool, unit testing, mocking, and interacting with Web technologies from the basics of static content, database integration, through the inescapable JavaScript, and onto more advanced (and trendy) topics like NoSQL, websockets and Async programming.
Read it here for free
Introduction:
- Praise for Test-Driven Development with Python
- Preface
- Prerequisites and Assumptions
- Companion Video
- Acknowledgments
Part 1: The Basics of TDD and Django
- Chapter 1: Getting Django Set Up Using a Functional Test
- Chapter 2: Extending Our Functional Test Using the unittest Module
- Chapter 3: Testing a Simple Home Page with Unit Tests
- Chapter 4: What Are We Doing with All These Tests?
- Chapter 5: Saving User Input
- Chapter 6: Getting to the Minimum Viable Site
Part 2: Web Development Sine Qua Nons
- Chapter 7: Prettification: Layout and Styling, and What to Test About It
- Chapter 8: Testing Deployment Using a Staging Site
- Chapter 9: Automating Deployment with Fabric
- Chapter 10: Input Validation and Test Organisation
- Chapter 11: A Simple Form
- Chapter 12: More Advanced Forms
- Chapter 13: Dipping Our Toes, Very Tentatively, into JavaScript
- Chapter 14: Deploying Our New Code
- Chapter 15: User Authentication, Spiking and Mocking
- Chapter 16: Testing external dependencies using mocks
- Chapter 17: Test Fixtures, Logging, and Server-Side Debugging
- Chapter 18: Finishing “My Lists”: Outside-In TDD
- Chapter 19: Test Isolation, and “Listening to Your Tests”
- Chapter 20: Continuous Integration (CI)
- Chapter 21: The Token Social Bit, the Page Pattern, and an Exercise for the Reader
- Chapter 22: Fast Tests, Slow Tests, and Hot Lava
Epilogue and appendices:
Harvey, K. (2015) Test-Driven Development with Django, Packt Publishing
Download eBook PDF (PDF 4,148KB)
Download Source Code (ZIP 221KB)
Develop powerful, fully-featured Django applications by writing tests first
- Deliver feature-complete projects by encoding user stories and features in functional tests
- Take a deep dive into browser-based testing with Selenium and Django’s LiveServerTestCase
- An example driven, comprehensive guide to exploring test-driven development techniques with Django
This book is for Django developers with little or no knowledge of test-driven development or testing in general. Familiarity with the command line, setting up a Python virtual environment, and starting a Django project are assumed.
- Codify user stories as browser-based tests to ensure their completion
- Write isolated unit tests that not only confirm your application, but also explain it
- Use the red-green-refactor TDD cycle to create and refine your code by changing tests first
- Test integrations with external APIs by testing their documentation
- Mock out calls to external services and internal functions
- Explore the basics of documentation-driven API design
- Other testing tools available in popular Python packages such as Django REST framework and VCR.py
Test-Driven Development (TDD) simplifies the trickiest of software tasks with its unique ability to peel back problems into layers. The testing tools available in Python and Django make test writing a joy, and the full coverage test suite that results from TDD is a boon to any project.
This guide to developing with Django takes a test-first approach: write a test, then write enough production code to get it to pass. You’ll quickly get hands-on experience, writing tests for a database-driven application with the TDD methodology. Use this book to build the skills and habits that make testing a regular part of your workflow.
Table of Contents
Jaiswal, S. and Kumar, R. (2015) Learning Django Web Development, Packt Publishing
From idea to prototype, a learner’s guide for web development with the Django application framework
- Build two real-life based projects, one based on SQL and other based on NoSQL
- Best practices to code, debug, and deploy the Django web application
- Easy to follow instructions and real world examples to build highly effective Django web application
This book is for web developers who want to get started with Django for web development. Basic knowledge of Python programming is required but no knowledge of Django is expected.
Django, written in Python, is a web application framework designed to build complex web applications quickly without any hassle. It loosely follows the MVC pattern and adheres to the Don’t Repeat Yourself principle, which makes a database-driven application efficient and highly scalable, and is by far the most popular and mature Python web framework.
This book is a manual that will help you build a simple yet effective Django web application. It starts by introducing Django, setting it up, and shows you how to code simple programs. You will then learn to build your first Twitter-like app. Later on, you will be introduced to Hashtags, AJAX to enhance the user interface, and tweets. You will then move on to create an administration interface, learn database connectivity, and use third-party libraries. Then you will learn to debug and deploy Django projects, and also get a glimpse of Django with AngularJS and Elasticsearch. By the end of the book, you will be able to leverage the Django framework to develop a fully functional web application with minimal effort.
- Build Django web application right from scratch
- Use version control to manage the development project
- Learn to use Django with both SQL and NoSQL databases
- Build faster and more efficient webpages using a frontend framework Twitter Bootstrap
- Improve web application performance with caching
- Enhance your user interface with AJAX and add flavors to your website
- Deploy the Django web application to clouds such as AWS, Heroku, and OpenShift
- Get familiar with AngularJS and Elasticsearch for Django
Table of Contents
George, N. (2016) Mastering Django: Core: The Complete Guide to Django 1.8 LTS, GNW Independent Publishing
Companion Web Site: http://masteringdjango.com/
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.
Welcome to Mastering Django
We have a pretty simple mission at Mastering Django:
- Provide the best resources and training for programmers wanting to become Django professionals; and
- Work with employers to ensure our training provides them with a pool of programmers with validated and usable skills.
If you are just starting out in programming you are in the right place.
Python (the language Django is built on) is everywhere – from running many of your favorite websites, to powering the scripts behind the latest CG blockbusters and 3D games. Python is as powerful as any other programming language, with the added advantage of a simple and clear style that has made it the top language for teaching programming.
Even better, later in your career, if you have to learn a new programming language with a much steeper learning curve (like Java), you will find it much easier to grasp once you have learned all the fundamentals in Python.
Django is a web framework that has had strong growth over the last 8 years, and with good reason – it has all power of Python built right in. Easy to program, powerful, secure and scalable – Django will have you up and running with sophisticated, responsive web-apps faster than any other framework.
If you are a professional programmer you are in for a treat!
Django and Python free you from the bloat and the boilerplate, the arcane structures and twisted tangles of tags, scripts and HTML. Rediscover the joy of programming :).