DjangoProject is a high-level construct that creates a complete CI pipeline for Django applications. It combines Django-specific checks with Docker image building and publishing.
Overview
TheDjangoProject construct creates two sequential jobs:
- DjangoCheckJob - Lints and tests the Django project
- DockerPublishJob - Builds and publishes a Docker image
Constructor
Parameters
The cdkactions Workflow instance to add jobs to.
Configuration object for the Django project.
Name of the Django project to test (used for running tests and migrations).
Name of the Docker image to publish (e.g.,
my-app-backend).Custom ID suffix to append to job names and IDs. Useful when using multiple DjangoProject instances in a single workflow.
Location of the Django project within the repository.
Optional props to customize the Django check job (Python version, dependencies, etc.).
Optional overrides for the check job configuration.
Optional props to customize the Docker publish job (registry, tags, etc.).
Optional overrides for the Docker publish job configuration.
Properties
The ID of the Docker publish job. Use this to create job dependencies.
The full name of the Docker image that will be built and published.
Basic Usage
Add a Django project workflow to an existing workflow:Advanced Usage
Multiple Django Projects
Use theid parameter to differentiate between multiple Django projects:
Custom Python Version
Configure the Python version used for testing:Using Job ID for Dependencies
Create jobs that depend on the Django project completing:Full Example with React
Combine Django and React projects in a single workflow:Generated Workflow
TheDjangoProject construct generates the following job sequence:
See Also
- ReactProject - Similar construct for React projects
- LabsApplicationStack - Complete stack for Django + React apps
- DeployJob - Deploy your built images