
Learn to design and implement a Django DRF e commerce inventory RESTful API, including database design, routers, view sets, and sterilizers, with testing and documentation for front end integration.
Install Python 3.9.5 on Windows 10 or 11 from python.org, add to path, choose 64-bit, customize install location, and verify with python --version.
Install and set up Visual Studio Code for Django development, choose a dark theme, create a project folder, enable auto save, use the terminal, and explore file explorer basics.
Create and activate Python virtual environments in Visual Studio Code, isolate project dependencies, handle PowerShell execution policy adjustments, and understand activation and deactivation steps for Django projects.
Install python 3.9.5 on macOS from python.org, choose the universal two installer for M1/M2, and verify with python3 --version, using Stack Overflow for troubleshooting.
Install and set up Visual Studio Code on mac, create a project folder, use explorer tab, enable autosave and zoom, and use the terminal for coding.
Create, start, and manage a Python virtual environment for a Django project, activate it in the terminal, and deactivate to keep project dependencies isolated.
Prepare a new virtual environment for your Django project using Python and Visual Studio Code, then create and activate the venv on macOS and Windows via the terminal.
Discover the Python package index (PyPI) and search Django packages. Learn pip commands—install, uninstall, list, freeze—and use requirements.txt to replicate environments.
Install Django from the Python package index using pip, activate your virtual environment, view installed packages, and freeze them to a requirements.txt so others can replicate the environment.
Create a new Django project and verify its setup by starting the development server with manage.py, then open the provided URL to confirm installation.
Discover how to create a Django application after building a Django project, using the startapp command across platforms, and organizing apps like product and checkout within a core folder.
Learn how to register a new django application within the core project by adding the app to the settings installed apps, ensuring django detects models, views, and templates.
Start the Django development server with runserver using macOS, Linux, or Windows commands. Understand 127.0.0.1 loopback and port numbers like 8000 (or 8080) for local access.
Trace how a browser request reaches a Django app and matches a URL to a view. The view renders a template with data and returns html to the browser.
Extend django url patterns by migrating, launching the server, and routing the home page and admin site through a new app with include and urls.
Create your first Django view as a function, wire it to URLs, and return an HTTP response such as hello world to display in the browser.
Create a new html template by adding a templates folder and index.html, then connect it to a view to serve html to the browser via the Django request-response cycle.
Connect templates to a view using render to serve the index template in response to a URL request, then run the server and refresh to see the updated output.
learn to set up a django project by creating and activating a virtual environment, installing dependencies from a requirements text file with pip -r, and running migrations and the server.
Define a preliminary table list and field list for the inventory RESTful API by analyzing requirements and identifying entities such as product, product line, and category, with their fields.
Identify and resolve multivalued fields in an ecommerce database by normalizing data into separate tables, such as images and attributes, to reduce redundancy and prevent update anomalies.
Maintain consistency with unique, descriptive table and field names across the database, while balancing design and implementation choices in Django and SQL, and noting PEP8 for Python naming.
Explore how to uniquely identify rows with primary keys in a Django relational database, and how integers like the auto-generated id field enable foreign keys and table relationships.
Map each field to Django model field types such as character field, URL field, integer field, and decimal field, and define max length, validators, and primary keys.
Learn how to model table relationships in an ecommerce database, including one-to-one, one-to-many, and many-to-many, with foreign keys and join tables.
Set up a new django project for a drf eCommerce app by installing python, creating and activating a virtual environment, installing django with pip, and starting the server.
Learn to configure a Django DRF ecommerce project with modular settings: base, local, and production files, and switch between development and deployment environments using debug and allowed hosts.
Generate a secure Django secret key using built-in tools, understand its role in cryptographic signing, and learn to store it securely with environment variables for local and production environments.
Record installed packages with pip freeze to reproduce the project across virtual environments, using a requirements.txt and pip install -r to install Django and related dependencies.
Configure environment variables to securely store secrets like the Django secret key and database credentials, load them into settings via a .env file, and prepare for production deployment.
Install and configure the Django rest framework in a virtual environment, update requirements, and add rest framework to installed apps to begin building the ecommerce API.
Set up pytest in a Django Rest framework project, configure the ini file, organize tests in a folder, and optionally validate the setup with a simple example test.
Master source control with Git and GitHub Desktop by creating a new django drf ecommerce repository, committing changes, and pushing to GitHub while configuring .gitignore for sensitive files.
Explore essential Visual Studio Code extensions from the extension marketplace, including the Microsoft Python extension with IntelliSense, linting, and debugging, and optional sqlite tooling for database work.
Learn how Python Black automatically formats code and how to install and integrate it with Visual Studio Code for auto format on save, including line length and import organization.
Configure linting with flake8 in Visual Studio Code, set line length to 88, enable lint on save, and understand how flake8 interacts with black.
Create a development branch from the main branch on GitHub, commit changes there, and merge the updates back into main to keep the code up to date.
Create and register the product app inside the drf e commerce project. Register the app in settings and run the server to verify.
Build the Django category, product, and brand tables, establish a one-to-many brand-to-product relationship, and implement nested categories with Django Empty and on delete protection.
Create a Django DRF category serializer to convert category, brand, and product models into JSON for a front-end client, then connect via viewsets and routing to expose the RESTful API.
Build a Django rest framework view set for categories, using a query set and serializer to return JSON data to the front-end client via the API.
Implement a default DRF router to auto-create endpoints from a category view set under the API prefix. Connect routes with include and test migrations and admin access.
Learn how to generate and document a Django DRF e-commerce API using DRF spectacular and Swagger UI, including schema creation, automatic endpoint docs, and front-end Swagger interaction.
Implement a brand endpoint in the Django DRF eCommerce RESTful API by creating a brand serializer, a brand view set, registering the brand URL, and testing via the API schema/docs.
Connect the product model to brand and category via foreign keys and serialize related data with nested serializers. Expose a product endpoint that returns brand and category details.
Set up coverage with PI test to auto discover tests and generate an html coverage report for your Django DRF ecommerce project, and identify needed tests in models and views.
Compare unit tests and end-to-end tests, then demonstrate mocking to isolate a unit. Validate an API workflow from client request to database response.
Identify what to test in a Django project by categorizing components into unit tests for models, serializers, views, and URL configurations, plus end-to-end API endpoint tests.
Learn to test Django models with factories in a DRF eCommerce project. Use Factory Boy to generate realistic data for category, brand, and product models and verify model behavior.
Test end-to-end APIs using the API client in a Django rest framework project by validating endpoints, responses, and database interactions with fixtures and factories.
Create a new commit with a descriptive summary of changes, commit to dev 1.0.1, and push to GitHub to keep the repository up to date.
Merge the dev 1.0.1 branch into main via pull requests, compare changes, push commits, and review history to maintain a clean GitHub repository and proper branch management.
Create a new development branch from the main branch named 1.0.2 (dev 102), focus on the sub product inventory table features, commit changes, and merge back to main after testing.
Build the product line model in Django Rest Framework for an ecommerce project, adding price, sku, stock quantity, a product foreign key with cascade delete, and is_active for activation.
Build the product line serializer in Django DRF, include all fields, and connect its foreign key product to the product sterilizer.
Dive into building a rest api for an e-commerce app by analyzing user stories, identifying data endpoints, and modeling category, product, and product detail retrieval.
Build a category filter endpoint for products by category name using Django REST framework extra actions; leverage a view set to return products by category and document the endpoints.
Learn to filter and return a single product in a Django DRF eCommerce API by using a slug lookup for a single-item retrieval instead of the primary key.
Learn to edit multiple models on a single admin page using tabular inline, linking product and product line in Django.
Learn to handle reverse relationships in django rest framework by exposing product line data through the product serializer with a related name and many=True, and refine output with field exclusion.
Map and flatten serializer field names in django drf to output category name and brand name within a single product json, using fields, source, and character field types.
Reduce n+1 queries in django drf ecommerce by using select related for category and brand and prefetch related for product lines, enhancing data retrieval and performance.
Learn to create custom Django model managers and query sets to filter active products and extend queries for an ecommerce REST API.
Explore building a custom order field in Django to order product lines per product, auto-generate order values with pre-save validation, and support front-end display and image ordering.
Run tests with pytest and view coverage reports to identify gaps. Configure pytest with a setup.cfg for scalable test settings across packages, and learn to run focused tests.
Develop and validate a new product line model in Django DRF, focusing on the model clean method, duplicate order validation, and expanding test coverage using factories.
Build and validate end-to-end tests for a Django rest framework e-commerce API by creating product and category endpoints and verifying slug-based queries.
Merge the 1.02 development branch into main after migrations cleanup, updating gitignore, and pushing commits, then create a pull request and start a new development branch.
Create a new Git branch from main in source control for development, name it dev, refresh GitHub desktop to pull updates, and prepare to develop with the updated data.
Implement the product image model with name, alt text, and url; link to product line with cascade delete and add an order field and pillow-based image field for API endpoints.
Create an admin inline for product images under each product line and add a reverse admin url edit link to navigate to the product line change page.
Design and integrate a product image serializer in a Django DRF eCommerce API, linking images to product lines via a one-to-many relationship and exposing price, sku, stock quantity, and order.
Eliminate the n+1 query problem in django rest framework by using select_related and prefetch_related to fetch products, categories, brands, product lines, and images in fewer queries.
Update your test factories to include a new product image factory. Import the product image model, define fields for alternative tax, your url, and product line with a subfactory.
learn to build and run simple model tests for a django rest framework e commerce api, using product image factories, test data, and debugging naming and factory wiring.
Merge the dev 1.03 branch into main, review changes, open a pull request, and merge to prepare the main branch for the next development branch.
Create a new git branch in the GitHub repository from the main branch, using the view branches menu, name it dev 1.0, and refresh to confirm.
Implement attribute models for product lines by creating attribute and attribute value tables, establishing a through table for the many-to-many relationship, and handling migrations and constraints.
Create an attribute value inline and attach it to the product line admin to manage attributes on product forms. Link the through model for the reverse relationship.
Build and wire a product attribute serializer for the product line, returning attribute names and values via a many-to-many relationship, and integrate it into the product serializer for front-end presentation.
Design a flexible product attribute system by linking product lines to product types, using a link table to model attribute-to-product-type many-to-many relationship, and enabling data retrieval with foreign keys.
Implement product type tables. Link product line to product type with foreign key, and create product type attribute many-to-many via intermediate table, with a unique constraint and on delete protect.
Set up Django admin inline for product types, implement migrations, and configure many-to-many relationships to connect product types, attributes, and product lines in a Django DRF e-commerce API.
Customize the serialization output in Django DRF to return the attribute ID and value for product lines, enabling the front end to present data accurately.
Learn to enforce unique attribute assignments for each product line by implementing a two-step validation in Django rest framework, preventing duplicate attribute values and ensuring clean saves.
Improve the performance of the product attribute query in the django drf e commerce rest api by using select_related and prefetch_related to fetch attributes and attribute values efficiently.
Learn to expose product type attributes via a serializer method field in a Django DRF eCommerce RESTful API, enhancing product detail with type-specific attributes.
Diagnose test failures in a Django DRF eCommerce RESTful API by resolving integrity errors, creating product type factories for foreign keys, and running tests iteratively to ensure success.
Explore how factory boy automatically populates a testing database and models many-to-many relations between product type, attribute, and attribute value, using a join/link table and post generation to link data.
Developing applications can be a fun and effective way of learning a language and framework. In this course, at phase 1, we start building and testing an eCommerce inventory RESTful API with DRF (Django Rest Framework).
This course is primarily designed for anyone looking for a learning journey building applications with the Django Rest Framework, developing, testing and documenting a RESTful API.
Currently, this course presents our first iteration of this course and phase 1 of the development process. This course will evolve and extend over time as we iterate on the content to maximise learning opportunities.
As presented in phase 1 of the course, we initiate the project and start building and testing the core functionality of the RESTful API application. In Phase 1, we learn the fundamentals of the Python Django Rest Framework, design a database, implement testing throughout the application and work towards building our first endpoints while also automatically documenting our efforts. By the end of phase 1, you will have learnt how to start a new Django DRF project and create routers, serializers and viewsets to enable clients to interact with your API. Throughout the development process, we learn how to test our application using Pytest and document our endpoints in preparation for front-end development using SwaggerUI.
We intend to extend the content of the course to eventually include deeper relevant content to aid further your understanding of the development process and techniques, deployment, and other associated technologies. Due to the scale of our courses we hope to bring to you our approach to building courses is a phased, iterative approach. Having time to reflect, analyse and seek feedback is essential to ensure that we develop courses that will ultimately meet the highest expectations.
I hope you enjoy the course.