
Build a Django middleware package that inspects SQL queries and prints them to the terminal, then package, test with pytest, and publish to PyPI.
Install python on Windows, download from python.org, choose 64-bit, add python to path, customize install location on the C drive, verify with python --version.
Learn to install and configure Visual Studio Code on Windows, open a project folder, and use auto save, zoom, and the integrated terminal for Django or Python development.
Create and activate Python virtual environments in Windows using VS Code, leveraging venv folders and activate scripts, and address PowerShell execution policy to isolate Django project dependencies.
Install and set up Visual Studio Code on macOS, create a Python project, and explore the file explorer. Enable auto save, adjust zoom, and use the integrated terminal.
Install python on macOS using python.org, select the macOS universal two installer for M1/M2, or Intel if needed. Verify with the terminal by running python3 --version to confirm Python 3.9.5.
Create and activate a macOS virtual environment for a Django project using python3 -m venv, then work inside the venv by sourcing venv/bin/activate.
Initiate a new Django project by creating a Python virtual environment, installing Django, and starting the project to run the server on port 8000.
Create a requirements file to list project dependencies, then use pip to freeze, save as requirements.txt, and install them with pip install -r requirements.txt to reproduce the environment.
Create a new django app named sql query, activate the virtual environment, and run manage.py startapp to generate it. Register the app in settings installed apps so Django recognizes it.
Create a Django model named product with fields for name (char up to 100), slug, and is_digital, then migrate to SQLite and inspect the table in the terminal.
Explore the Django request–response cycle, middleware flow, and how a function-based view uses the ORM to query data, serialize to JSON, and return a JSON response.
Create a Django url path that connects to the home view and serializes data for the response. Run the server to test the route and handle safe parameter false.
Learn to populate a Django database using Factory Boy and Faker to generate data, including creating a product factory, configuring fields, and inserting 100 rows via the Django shell.
Capture and display Django-generated SQL queries in the terminal to diagnose performance and optimize data retrieval. Enable debug mode, trigger query execution, and print the SQL from the view.
Explore how Django middleware acts as an intermediate layer, processing requests and responses, with a function-based example, activation in settings, and the request response cycle order.
Develop a Django SQL query inspector middleware to capture query counts, execution time, and duplicates, and prepare it as a Python package for pip installation.
Package your SQL query inspector middleware for Django package distribution on PyPI and validate it on TestPyPI before uploading to the Python Package Index, preparing your package description and metadata.
Package a simple Django middleware as a Python package for distribution on the Python Package Index, including license, readme, toml metadata, and dependencies like Django, Pygments, SQL, and Python 3.11+.
Package and distribute the django sql middleware project using setup tools, build distributions, and publish to the python package index with pip.
Log in to the Test PyPI service, search for your package, and view its metadata, licenses, and links. Install and manage your package from Test PyPI.
Learn how to install a Django middleware package from the test Python package index using pip, inspect the virtual environment, and integrate the downloaded middleware into a Django project.
Learn to set up pytest for testing a Django middleware package by creating a standalone Django app, configuring pytest to discover tests, and choosing between unit and end-to-end tests.
Test middleware in a stand-alone Django app by simulating a request-response cycle with a demo app, mock data, and pytest, capturing SQL query outputs through the middleware.
Update the requirements and install pytest to capture the standard output from the middleware. Test that the view runs one query and prints one total queries to stdout.
Create and publish a new GitHub repository, using Git for version control and GitHub desktop, configure a .gitignore, commit changes, push, and automate uploading to Python package index with actions.
Automate building and publishing a Python package to test and main PyPI using GitHub actions. Create and configure a workflow, secrets, and release process to package and publish securely.
Deploy your python package to pypi by switching the readme to markdown, renaming readme.md, updating pyproject.toml references, and previewing markdown in VS Code for the Very Academy SQL Tools package.
Publish your Django SQL middleware package to the main PyPI by creating a PyPI account, generating an API token, updating the GitHub actions secret, and releasing to the main index.
The Python Package Index (PyPI) is a software repository for the Python programming language. in this course, we teach you how to build and publish a Python package to the PyPI. The package we built and published is centred around a Django middleware tool we developed in this course. We start by learning how to build a Django project and how to inspect SQL queries executed by a Django application. We will learn the basics of Django Middleware and how to build a simple middleware component that will form our package's basic functionality. Once we grasp the fundamentals of Django, Django middleware and how to capture SQL queries executed by Django, we move to the next phase, building a new package. In the first stages, we explore the essential files and configurations required to build a new package. We then incorporate the middleware we have built previously and build our package in preparation for being uploaded to the PyPI. The life cycle of our application does not stop after distribution. Therefore we take the following steps to automate the delivery of our app to the PyPI. We develop GitHub actions to manage the packaging and upload of the package to the PyPI. In this course, we provide an introduction to testing with Pytest, creating stand-alone Django apps to aid the testing process.