Becoming an Enterprise Django Developer: Discover best practices, tooling, and solutions for writing and organizing Django applications in production
- Length: 526 pages
- Edition: 1
- Language: English
- Publisher: Packt Publishing
- Publication Date: 2022-06-27
- ISBN-10: 1801073635
- ISBN-13: 9781801073639
- Sales Rank: #1812083 (See Top 100 Books)
A Python web developer’s guide to exploring the Django development lifecycle, beyond the basics
Key Features
- Expert tips to help you use the right packages, tools, and libraries and understand their scope for your project.
- Develop Django apps in any Windows, Mac or Linux environment.
- Learn best practices for creating a project structure made for better performance.
Book Description
Django is a powerful framework but choosing the right add-ons that match the scale and scope of your enterprise projects can be tricky. This book will explore the multifarious options available for enterprise Django development. Countless organizations are already using Django and more are migrating to it, unleashing the power of Python with many different packages.
This practical guide will help you understand practices, blueprints, and decision-making tactics to put Django to work the way you need it. You’ll learn various ways in which data can be rendered onto a page and discover the power of Django for large-scale production applications. Starting with the basics of getting an enterprise project up and running, you’ll get to grips with maintaining the project throughout its lifecycle while learning what the Django application lifecycle is.
This book covers examples in Windows to give you a feel of working with tools such as Visual Studio that effectively manage large-scale Django applications. However, you’ll be able to use this book working on a Mac or Linux system too, providing you with suggested tools and commands to work with each exercise on every major platform.
By the end of this book, you’ll have learned how to build and deploy a Django project to the web and implement various components into your site.
What you will learn
- Create and configure a proof-of-concept Django project on a local machine.
- Understand the steps and tools used to scale up a proof-of-concept project to production without going too deep into specific technologies.
- Explore core Django components and how to use them in different ways to suit your app’s needs.
- Find out how Django allows you to build RESTful APIs.
- Write and run test cases using the built-in testing tools in Django.
- Extract, parse, and migrate data from an old database system to a new system with Django and Python.
Who This Book Is For
This book is for Django developers who want to learn the full-stack enterprise app development lifecycle. If you are a Python web developer looking to learn how to maintain a production website and explore Django beyond the basics, this book is for you. The book assumes intermediate-level knowledge of Python programming and the Django framework but is custom tailored for beginner developers too.
Becoming an Enterprise Django Developer Contributors About the author About the reviewer Preface Who this book is for What this book covers To get the most out of this book Download the example code files Code in Action Download the color images Conventions used Get in touch Share Your Thoughts Part 1 – Starting a Project Chapter 1: Undertaking a Colossal Project Technical requirements Building an enterprise Reasons to choose enterprise-level applications Types of enterprise systems Why Python/Django? Types of APIs Designing and planning Requirements gathering Visualization and interpretation Hosting and deployment Creating and configuring a Heroku plan Configuring Heroku environments Custom repositories Advanced deployment Domain Name System Summary Chapter 2: Project Configuration Technical requirements Choosing development tools Text editors Integrated development environments Starting a project Using the IDE Using the command line Creating a virtual environment Configuring the requirements.txt file(s) Using the IDE Using the command line Project configuration Django settings.py file Creating an environment file Creating a Procfile Django static files Django media files Creating a .gitignore file Creating a Django app Using basic database settings SQLite MySQL MariaDB Oracle SQL Server PostgreSQL Preparing PostgreSQL for Heroku Installing PostgreSQL Using the PgAdmin tool Environment connection settings Building initial table structures Remote data migrations Heroku database push/pull operations Summary Chapter 3: Models, Relations, and Inheritance Technical requirements Preparing for this chapter Writing model classes Standard field types Third-party field types Model field validators Working with model field relationships Field arguments Field type – ForeignKey Field type – ManyToManyField Mutable versus immutable objects Using the Meta subclass Meta options – verbose_name and verbose_name_plural Meta option – ordering Meta option – indexes Meta option – db_table Customizing models Writing methods Decorators Extending models Extending basic model classes Extending the Django User model Using the Django shell Running basic Python scripts Generating a SECRET_KEY variable Saving data Loading the chapter_3 data fixture Performing queries Model method – all() Model method – get() Model method – filter() Aggregates Writing model managers Summary Part 2 – Django Components Chapter 4: URLs, Views, and Templates Technical requirements Preparing for this chapter Configuring URL patterns Basic path functions Redirecting patterns Using path converters Mapping URL patterns Using simple views Using kwargs in views Working with conditional responses Linking models to views and templates Resolving URLs Naming URL patterns Using the reverse() function Using the {% url %} template tag Processing trailing slashes Resolving absolute URLs Creating a context processor From the request object From within a model class Working with complex views Class-based views Extending class-based views Asynchronous views Working with templates Template tags Template filters Custom tags and filters Error page templates Summary Chapter 5: Django Forms Technical requirements Preparing for this chapter Types of forms Form class – Form Form class – ModelForm Using form fields Common field arguments Field widgets Field validators Cleaning forms Method – clean_{{ your_field_name }}() Method – clean() Creating custom form fields Field class – Field Using a custom field Working with form views View class – FormView HTTP request methods Rendering forms in templates Render form – as_p Render form – as_table Render form – as_ul Render form – using template_name Render demo Linking a model to a form View class – CreateView View class – UpdateView Adding inline formsets Formset function – formset_factory Using inline formsets in the view class Rendering inline formsets in the template Dynamic inline formsets Summary Chapter 6: Exploring the Django Admin Site Technical requirements Preparing for this chapter Using the Django admin site Activating the Django admin site Logging into the Django admin site Writing admin classes Registering models Configuring admin class options Changelist view-related options Change/add view-related options Add view-related options Adding admin class methods Method – get_form() Method – save_model() Method – delete_model() Writing custom admin form classes Initializing an admin form Using the Django authentication system Adding a seller Granting permissions Permission groups Summary Chapter 7: Working with Messages, Email Notifications, and PDF Reports Technical requirements Preparing for this chapter Creating a Mailtrap account Using the Django messages framework Enabling the Django messages framework Creating a message Displaying messages Configuring email notifications As plain text emails As HTML emails As HTML emails with a plain text alternative With file attachments That fail silently Writing custom email templates For plain text emails For HTML emails Providing template context Generating PDF reports As template-based PDFs Adding context Summary Part 3 – Advanced Django Components Chapter 8: Working with the Django REST Framework Technical requirements Preparing for this chapter Installing the Django REST framework Serializing objects The serializer classes The viewset classes Using URL routers Using the Browsable API Building SPA-like pages Creating the view Building the template Writing the JavaScript Mapping the URL pattern First demo Writing custom API endpoints Creating the view Building the template Modifying the JavaScript Mapping the URL pattern Second demo Authenticating with tokens Project configuration Creating the view Building the template Modifying the JavaScript Mapping the URL pattern Third demo Summary Chapter 9: Django Testing Technical requirements Preparing for this chapter Understanding automated testing in Django Getting started with unit testing Basic unit test script Testing Django models Testing HTTP view requests Testing method-based views Testing class-based views Testing authenticated view requests Using the Client() class Testing Django REST API endpoints Creating an object test case Updating an object test case Using the DjDT Installing the DjDT How to use the DjDT Summary Chapter 10: Database Management Technical requirements Preparing for this chapter Exporting data into a data fixture Using the dumpdata command Importing data from a data fixture Using the importdata command Using the select_related() method Creating the view Building the template Mapping the URL pattern First demo Using the prefetch_related() method Vehicles view Sellers view Using the Prefetch() class Modifying the view Modifying the template Fourth demo Summary Why subscribe? Other Books You May Enjoy Packt is searching for authors like you Share Your Thoughts
Donate to keep this site alive
How to download source code?
1. Go to: https://github.com/PacktPublishing
2. In the Find a repository… box, search the book title: Becoming an Enterprise Django Developer: Discover best practices, tooling, and solutions for writing and organizing Django applications in production
, sometime you may not get the results, please search the main title.
3. Click the book title in the search results.
3. Click Code to download.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.