Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Prerequisites

- [cookiecutter](https://cookiecutter.readthedocs.io/en/latest/installation.html) installed
- [cookiecutter](https://cookiecutter.readthedocs.io/en/latest/installation.html) or [uv](https://docs.astral.sh/uv/getting-started/installation/) installed

## Django template

Expand All @@ -15,6 +15,8 @@
2. Run the following command to create a new Django project using the newest template version:
```shell
cookiecutter https://github.com/singularit-de/cc-python.git --directory django
# or
uvx cookiecutter https://github.com/singularit-de/cc-python.git --directory django
```
Comment thread
Grayknife marked this conversation as resolved.

1. If you want to use a specific version/branch you can use the `--checkout <tag/branch>` option:
Expand All @@ -24,7 +26,32 @@

## Why we are using templates

## Contribute to this repository
Cookiecutter templates ensure consistency, standardization, and best practices across all Python projects at singularIT. They:

- **Reduce setup time** by automating project initialization and boilerplate configuration
- **Enforce conventions** with a standardized directory structure, naming patterns, and tooling (ruff, pre-commit, etc.)
- **Ensure quality** by baking in linting, formatting, and testing configurations from the start
- **Simplify maintenance** by allowing template updates to benefit all projects using them
- **Enable team alignment** on development practices and technology choices

## Testing template updates locally
Comment thread
Grayknife marked this conversation as resolved.

If you contribute to the template you mostly want to test your changes locally before pushing them to the remote repository to see that everything works as expected.


1. Go into the top-level directory where your "cc-python" repository lives:

```shell
cd /path/to/the/cc-python/top-level-directory
```

2. Run the following command to create a new Django project using the local template version:

```shell
cookiecutter cc-python --directory django
# or
uvx cookiecutter cc-python --directory django
```

### Tech stack of this repository

Expand Down
1 change: 1 addition & 0 deletions django/{{ cookiecutter.project_slug }}/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ stages:
include:
- local: .gitlab/ci/*.gitlab-ci.yml
- component: singular-code.de/singularit/ci-components/utilities/size/all@1.2.0
- component: $CI_SERVER_FQDN/singularit/ci-components/security/dependency-audit/sbom@0.3.6
Comment thread
Grayknife marked this conversation as resolved.

variables:
POSTGRES_HOST_AUTH_METHOD: trust
Expand Down
41 changes: 41 additions & 0 deletions django/{{ cookiecutter.project_slug }}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,44 @@
```bash
pre-commit install
```

## GitLab CI/CD

GitLab CI/CD is a continuous integration and continuous deployment service built into GitLab. It automates tasks like testing, building, and deploying code on every push or merge request. Pipelines are defined in a `.gitlab-ci.yml` file at the repository root. Additional configuration can be modularized in the `.gitlab` folder for better organization:

```
.gitlab/
├── ci/
│ ├── lint.yml
│ ├── test.yml
│ └── deploy.yml
.gitlab-ci.yml
```

### Dependency Track

To track vulnerabilities in dependencies we are using our Dependency Track Dashboard. The dashboard is updated with every push to the default branch or a created tag.
The dashboard is updated with the help of the `uv.lock` file that is generated by uv.
You can view our Dependency Track Dashboard [here](https://dependency-track.v3.singular-it-test.de/).

### Stages

#### Lint

In the lint stage we are running `pre-commit` that checks for code formatting and linting issues.

When? Each push to a protected branch or a branch that has an open merge request to a protected branch.

#### Test

In general our test stage has 2 jobs:

1. `django-test` - runs the django unit tests
2. `deploy-check` - runs the django deployment check for security issues

When? Each push to a protected branch or a branch that has an open merge request to a protected branch.


#### Deployment to our v2 staging server

When? Each push to a protected branch.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "cc-django"
name = "cc-python"
version = "0.1.0"
description = "Cookiecutters for python projects @singularIT"
requires-python = ">=3.12"
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading