معرفی کتاب «دورهٔ فشردهٔ جنگو» (با عنوان لاتین Django Crash Course) نوشتهٔ Daniel Roy Greenfield, Audrey Roy Greenfield، منتشرشده توسط نشر Beta در سال 2020. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.
دانیل روی گرینفیلد و آدری روی گرینفیلد، نویسندگان مجموعهٔ پرفروش دو قاشق جنگو (Two Scoops of Django)، این بار با کتابی جدید و رویکردی تازه به سراغ علاقهمندان به این فریمورک محبوب آمدهاند. دورهٔ فشردهٔ جنگو (Django Crash Course) حاصل سالها تجربهٔ آموزش عملی به تیمهای نرمافزاری در سراسر جهان است و قرار است شما را در سریعترین زمان ممکن با جدیدترین نسخههای پایتون و جنگو راهی سفری پرماجرا کند.
دربارهٔ کتاب دورهٔ فشردهٔ جنگو
این کتاب یک راهنمای عملی و گامبهگام برای ساخت یک برنامهٔ تحت وب واقعی و باکیفیت با استفاده از جنگو.x و پایتون.۸ است. برخلاف بسیاری از منابع آموزشی که صرفاً به مبانی تئوری میپردازند، دورهٔ فشردهٔ جنگو شما را از همان ابتدا با پروژهای عملی درگیر میکند و مفاهیم کلیدی را در بستر پیادهسازی یک اپلیکیشن کامل آموزش میدهد. رویکرد کتاب بر اساس دورههای آموزشی گرانقیمت این نویسندگان برای شرکتها طراحی شده است و هدف آن انتقال سریع و مؤثر مهارتهای ضروری به توسعهدهندگان است. ساختار کتاب به سه بخش اصلی تقسیم میشود. بخش اول با عنوان «سلام، جهان در جنگو»، شما را با مفاهیم پایه و نحوهٔ راهاندازی یک پروژهٔ اولیه آشنا میکند. بخش دوم که قلب کتاب محسوب میشود، به شما نشان میدهد که چگونه با استفاده از الگوها و تکنیکهای حرفهای، یک برنامهی کاربردی کامل به نام «EveryCheese» را از صفر تا صد توسعه دهید. در این بخش، مباحث مهمی مانند طراحی مدلهای پایگاه داده، ساخت نماهای مبتنی بر کلاس (CBV)، استفاده از فرمها، مدیریت احراز هویت با جنگو-آلاوث (django-allauth) و نگارش آزمونهای جامع پوشش داده میشود. بخش سوم نیز به عیبیابی و بررسی پیامدهای کدنویسی اختصاص دارد. جذابیت دیگر کتاب، استفاده از زبانی نمادین، طنزگونه و البته ارجاعات دائمی به «پنیر» است که فضای آموزشی را از حالت خشک و یکنواخت خارج کرده و آن را برای خواننده لذتبخشتر میکند.
دربارهٔ نویسنده
دانیل روی گرینفیلد و آدری روی گرینفیلد از چهرههای تأثیرگذار و شناختهشده در جامعهٔ متنباز جنگو هستند. آنها پیش از این با مجموعه کتابهای دو قاشق جنگو، توانستند راهنمای عملی بینظیری برای توسعهدهندگان حرفهای فراهم آورند که به یکی از منابع مرجع در این حوزه تبدیل شد. آدری روی گرینفیلد، که فارغالتحصیل مؤسسهٔ فناوری ماساچوست در رشتهٔ مهندسی برق و علوم کامپیوتر است، در سال ۲۰۱۳ ابزار محبوب «کوکیکاتر» (Cookiecutter) را برای تولید الگوهای پروژه خلق کرد که اکنون بیش از دهها هزار ستاره در گیتهاب دارد. دانیل روی گرینفیلد نیز سابقهٔ فعالیت در سازمان فضایی ناسا و شرکتهای معتبر فناوری را در کارنامه دارد و در کنار همسرش، نقش فعالی در توسعهٔ کتابخانههای متنباز و ترویج جنگو ایفا کردهاند. آنها علاوه بر کتابهای فنی، در حوزهٔ داستاننویسی فانتزی نیز قلمزن هستند.
چرا باید دورهٔ فشردهٔ جنگو را بخوانید؟
**
آموزش مبتنی بر پروژه واقعی: با خواندن این کتاب، یک برنامهٔ کاربردی کامل و قابل ارائه را از مرحلهٔ ایده تا پیادهسازی و آزمون، قدمبهقدم دنبال میکنید و درک عمیقی از چرخهٔ توسعه با جنگو به دست میآورید. **
استفاده از تکنیکهای بهروز و حرفهای: نویسندگان با تکیه بر تجربهٔ خود به عنوان مدرسان ارشد شرکتها، بهترین شیوهها (Best Practices) را به شما آموزش میدهند و از همان ابتدا شما را با ابزارها و کتابخانههای استاندارد صنعت مانند کوکیکاتر، پستگرس اسکیوال و جنگو-کریسپی-فرمها آشنا میکنند. **
سبک نگارش منحصربهفرد و جذاب: فضای طنزآمیز و نمادین کتاب، به ویژه تم «پنیر» که در سراسر آن جاری است، یادگیری را از یک فرایند خشک و خستهکننده به یک ماجراجویی سرگرمکننده تبدیل میکند و انگیزهٔ خواننده را برای دنبال کردن مطالب تا انتها حفظ میکند. **
تمرکز بر آزموننویسی از ابتدا: برخلاف بسیاری از منابع که آزموننویسی را به انتهای مسیر موکول میکنند، این کتاب از همان مراحل اولیهٔ توسعه، اهمیت نگارش آزمونهای کارخانهای را به شما یادآور شده و به کدنویسی امن و قابل اعتماد عادت میدهد. **
منبعی برای ورود به مباحث پیشرفته: پس از اتمام این کتاب، پایهای محکم برای یادگیری مباحث تکمیلی مانند استقرار (Deployment)، جنگو آراست فریمورک (DRF) و فریمورکهای جاوااسکریپت خواهید داشت و میتوانید از محتوای تکمیلی اختصاصی این مجموعه بهرهمند شوید.
این کتاب برای چه کسانی مناسب است؟
این کتاب برای توسعهدهندگانی طراحی شده است که با مبانی زبان پایتون آشنایی دارند و میخواهند در کوتاهترین زمان ممکن، مهارتهای عملی خود را در زمینهٔ توسعهٔ وب با جنگو ارتقا دهند. این منبع به ویژه برای افرادی که از مطالعهٔ کتابهای صرفاً تئوری و مقدماتی خسته شدهاند و به دنبال یک دورهٔ فشرده و پروژهمحور برای ورود به بازار کار یا پروژههای حرفهای هستند، انتخاب بسیار مناسبی است. البته باید توجه داشت که این کتاب برای افرادی که هیچ پیشزمینهای از برنامهنویسی ندارند، توصیه نمیشود؛ زیرا مفروضات اولیهای دربارهٔ آشنایی با مفاهیم پایهای پایتون در آن وجود دارد.
سوالات متداول
آیا این کتاب برای افرادی که تازه با جنگو آشنا میشوند، مناسب است؟
این کتاب یک راهنمای گامبهگام است، اما دیدگاهها و نظرات دربارهٔ سطح آن متفاوت است. درحالی که برخی آن را منبعی عالی برای مبتدیان میدانند، برخی دیگر معتقدند که سرعت پیشروی آن نسبتاً بالاست و برای درک عمیق مفاهیم، نیاز به مطالعهٔ همزمان مستندات رسمی وجود دارد. بنابراین، اگر با برنامهنویسی پایتون آشنایی دارید، این کتاب شما را به سرعت وارد وادی پروژههای عملی میکند.
آیا کتاب صرفاً به کدنویسی میپردازد یا مفاهیم را نیز توضیح میدهد؟
نظر اکثر خوانندگان این است که کتاب بیشتر بر جنبهٔ عملی و «چگونگی» پیادهسازی تأکید دارد تا «چرایی» پشت صحنهٔ آن. ساختار کتاب به گونهای است که با دنبال کردن مثالها، یک برنامه کامل ساخته میشود، اما برای درک عمیق مفاهیم معماری جنگو، ممکن است نیاز به مکملهای آموزشی دیگری داشته باشید.
آیا برای شروع این کتاب به دانش پایگاه داده نیاز است؟
خیر، کتاب با مبانی راهاندازی یک محیط توسعه شامل نصب پستگرس اسکیوال (PostgreSQL) شروع میشود و شما را در ایجاد و مدیریت مدلهای پایگاه داده و مهاجرتها (Migrations) راهنمایی میکند. با این حال، آشنایی اولیه با مفاهیم پایگاه دادههای رابطای میتواند به درک بهتر مطالب کمک کند.
Copyright Introduction Why Learn Django? When the Going Gets Tough This Book is intended for Django 3.x and Python 3.8 How This Book is Structured Conventions Used in this Book The Ultimate Django Setup Goal: A Professional-Quality Development Environment Core Concepts Step 1: Install Conda Step 2: Install Visual Studio Code Step 3: Installing Git Step 4: Installing PostgreSQL Summary I Hello, World in Django Hello, World in Django The ``Hello, World'' of Python ``Hello, World'' of Django: Simple on Purpose Projects Goals Prerequisites Preparation: Install Dependencies What's a Dependency? Set Up a New Conda Environment Install Django Summary Generate a Starter Django Project Anatomy of a Bare-Bones Django Project manage.py settings.py Other Settings Exercise Create a Database and Run the Project Ensure We Are in the Hellodjango project Creating the Database Start Up Runserver Runserver Has Started Up Success! Create a Django-Superuser Stop runserver if It Is Still Running Run createsuperuser Summary Practice Using the Admin Restart runserver Visit the Admin Log in as Our Superuser Explore the Admin Recreating the Hello, World in Django Database Summary Generate a Homepage App Stop runserver if Needed Generate a Starter Django App Anatomy of a Simple 1-App Django Project Exercise Main Django Project vs Django Apps Prepping the Project for Templates Configure Your Templates Save! Lists? Dictionaries? Add a Simple Homepage View Get to Know URL Routing Add a URL Pattern for the Homepage Double-Check the Code Terminology: ``Wire in the URL'' Refresh the Page and Trigger an Error Create Our First Django Template Create a Templates Directory Add Index Template Start Up Runserver View the First Page Recap Understanding Views and the Templateview Class Working With Variables in Templates Our First Templated Value What Is my_statement? Extend HomepageView Refresh the Homepage Exercise: Play Around! Common Questions Calling View Methods From Templates Define a View Method Call the View Method From index.html Reload the Homepage Our First Project is Complete! Summary Next Steps II EveryCheese The EveryCheese Project Prerequisites Prepare the EveryCheese Programming Environment Create a New Virtual Environment Reactivating Conda Environments Summary Using Cookiecutter and Template Install the Cookiecutter Library Cookiecutter Project Templates Using django-crash-starter What Happened? Tips and Troubleshooting A Little Cookiecutter Background Exploring the Generated Boilerplate Some Basic Components Summary Starting Up Our New Django Project Let's Run the Project Go Into the EveryCheese Directory Start PostgreSQL if Needed Create the Database How to Create It Install the Dependencies Run the Migrations Start Up Runserver Cheese Boilers Initializing the Git Repo Committing and Pushing Why? We'll Use GitHub Create the GitHub Project Examine the GitHub Instructions Verify That the Files Got Committed Git Is Not for Stinky Cheeses What We Get From The Users App Register a Normal User Verify Our Email Why Are Emails Printed in the Console? Explore the User Profile Edit User Data Introducing UserUpdateView Introducing UserDetailview Understand the Name Field Understand the Code for UserUpdateView Add Email Addresses What About the Code? Adding User Bios Add a Bio Field Create and Run Migrations Update UserUpdateView Try It Out Adding Bio to User Detail Template Update the User Detail Template Add Line Breaks Commit Our Work Introducing Tests Why Test? Running Tests What Does a Test Look Like? The Test Foundations The Actual Test Using the assert KeyWord Introducing coverage.py Using coverage.py Generate an HTML Coverage Report More Users App Tests Summary User Profile Cheese Avatars Will Fit Into Cheese Holes The Cheeses App and Model Make Sure We're at the Project Root Create an App Called Cheeses Move It Into the Project Set the Cheese Config Add It to the List of Installed Apps Add the Cheese Model Create and Run the Initial Cheese Migration Trying Out the Cheese Model Let's Try It Out! Django Shell vs. Shell Plus Create a Cheese Evaluate and Print the Cheese View the Cheese's Name Add a String Method Try It Again Commit Our Work Tests and Test Coverage Check Test Coverage Create a Module for Cheese Model Tests Let's Test the __str__() Method. Enter ``The Game of Test Coverage'' Rules of the Game What's the Point of All This Anyway? Commit the Cheese Model Tests Summary The Cheeserator Adding Cheeses to the Admin We Need a Superuser Go to the Admin Explore the Admin So Far Register Cheese Model With the Admin Find Colby Enter More Cheeses via the Admin Some Notes About the Django Admin Commit Changes Summary Behind the Curtain We Are in Control Class Based View Fundamentals The Simplest Class-Based View Adding More HTTP Methods Advantages of Class Based Views Composition Composition Part II Intelligent Defaults Standardized HTTP Method Handling Tips for Writing Class-Based Views Writing the Cheese List View Wiring in the List View Url Define Cheese URL Patterns Include Cheese URLs in Root URLConf See the View in Action The Cheese List Template Create the List Template Fill in the Template See the List in Action Add a Nav Link to the Cheese List Explaining the cheeses:list Name Commit Our Work Add the CheeseDetailView Add the CheeseDetailView URL Pattern Link List Items to Detail Pages The Cheese Detail Template Add a Cheese Detail Template Visit Cheese Detail Commit Our Work Where to Dip Class Based Views Writing Factories for Tests Produce Cheese Test Data From Factories Define a CheeseFactory Try Out CheeseFactory Delete the Bogus Cheese Commit the Changes Why Use Factories Factories and Unit Testing Approach 1: Calling Create() Approach 2: Calling CheeseFactory() Other Uses Learn More About Factory Boy Using Factories in Tests Passing in Field Values Explicitly Bulk Generation Reviewing Our Cheeses Cheese Cleanup Replacing the Direct Cheese Model Call in Our Existing Test Removing the Name Entirely Commit Our Work Summary How Our Cheese Objects Feel About Your Tests Finding and Adding a Third Party Countries App Country of Origin Benefiting From Open Source Check Django Packages Review Django Countries on GitHub Look for the Release Number on PyPI Install It Implement in cheeses/models.py Migrations! Display Cheese Country Data Add Cheese Countries in the Admin Display Country in Cheese Detail Run the Tests Update CheeseFactory Verify That CheeseFactory Works Commit Our Work Implement Cheese Creation by Users Add a Cheese Creation View Add the Corresponding URL Pattern Specify the Desired Form Fields Define the Cheese Form Template Submit the Form Implement Get_absolute_url() Resubmit the Form Link to the Add Cheese Form Commit the Changes Use Django Crispy Forms for Better Display Isn't as_p() Enough? A Quick History Lesson Crispy Forms and Cookiecutter Django Our Non-Crispy Form Use the Crispy Template Tag Reload the Add Cheese Form Commit the Changes Understand View Mixins and LoginRequiredMixin User-Generated Content and Accountability Try Accessing the Add Cheese Form Anonymously Require Login Try Accessing It as Cheesehead View Mixins Commit the Changes Add a Creator Field and Update Our Cheese Records Add a Creator Field Make and Apply the Migration Commit the Changes Track and Display the Cheese Creator Set the Cheese Creator After Form Validation Display the Creator on the Cheese Detail Pages Try It Out Commit the Changes Update the Cheese Factory Run the Tests Modify Cheese Factory Run the Tests, Again Try CheeseFactory in the Shell Delete the Random Cheese Delete the Random User Commit the Changes Update the Cheese Model Tests Test Get_absolute_url() Commit the Changes Test All the Cheese Views What to Test? Start With Imports The First Cheese View Tests Really Test the Cheese List View Test the Cheese Detail View Test the Cheese Create View Commit the Changes Conclusion Test All the Cheese URL Patterns Add the Imported Cheese Write Our First Fixture Test the Cheese List URL Pattern Test the Add Cheese URL Pattern Test the Cheese Detail URL Pattern Commit the Changes Adding a CheeseUpdateView and Form Recycling Add the CheeseUpdateView Wire in the URL Pattern Try It in the Browser What Happened?!? Link to the Update Form Try It in the Browser Make Login Required Commit the Changes Test the Cheese Forms and Update View Refactoring our Cheese Fixture Test the Add Cheese Page Title Test That CheeseUpdateView Is a Good View Test That a Cheese Updates Correctly Commit the Changes EveryCheese is the Foundation! Summary Next Steps After This Book Giving Us Feedback III Aftermatter Troubleshooting Troubleshooting Conda Installations on Pre-Catalina OSX Troubleshooting Conda Installations on Catalina or higher OSX Troubleshooting PostgreSQL: Role Does Not Exist Troubleshooting PostgreSQL: Cannot Create Database Troubleshooting PsycoPG2 Troubleshooting GCC Errors on the Mac Troubleshooting the MS Visual Studio Build Tools Error Changelog Beta Changelog 2020-03-10 Beta Changelog 2020-03-06 Beta Changelog 2020-03-03 Beta Changelog 2020-02-26 Beta Changelog 2020-02-22 Beta Changelog 2020-02-21 Beta Changelog 2020-02-19 Alpha Changelog 2020-02-14 Alpha Changelog 2020-02-11 Alpha Changelog 2020-02-07 Alpha Changelog 2020-02-05 Alpha Changelog 2020-02-04 Alpha Changelog 2020-02-03 Acknowledgements Tech Reviewers Contributors to 3.x Beta Contributors to 3.x Alpha Typesetting