Skip to content

Commit e59776d

Browse files
authored
Merge branch 'master' into dependabot/pip/certifi-2025.4.26
2 parents c7236e7 + e43295a commit e59776d

File tree

4 files changed

+100
-44
lines changed

4 files changed

+100
-44
lines changed

README.md

Lines changed: 93 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
# Project Purpose
1+
# Django Reference Implementation
2+
3+
<div style="text-align: center;">
4+
5+
![Django](https://img.shields.io/badge/Django-5.1-green.svg)
6+
![Python](https://img.shields.io/badge/Python-3.12-blue.svg)
7+
![PostgreSQL](https://img.shields.io/badge/PostgreSQL-16-blue.svg)
8+
![License](https://img.shields.io/badge/License-MIT-yellow.svg)
9+
![Tests](https://img.shields.io/badge/Tests-Passing-brightgreen.svg)
10+
![Ruff](https://img.shields.io/badge/Linting-Ruff-purple.svg)
11+
12+
**Production-ready Django SaaS template with organizations, invitations, and solid authentication built-in.**
13+
14+
[Features](#features)[Quick Start](#quick-start)[Architecture](#architecture)[Why This Template?](#why-this-template)[Documentation](#documentation)[Contributing](#contributing)[License](#license)
15+
16+
</div>
17+
18+
## Project Purpose
219
This project is a reference implementation for a production-ready Django
320
application with common use cases baked in. It is the base application that
421
Simple CTO uses for its projects, and we hope that it can be helpful to you.
@@ -9,39 +26,64 @@ build applications, and this is ours. You are welcome to fork, copy, and
926
imitate. We stand on the shoulders of giants, and you are welcome to as
1027
well.
1128

12-
---
13-
14-
# Getting Started
29+
## 🚀Quick Start
1530

1631
You are impatient, I get it. Here is the [quick start guide](docs/getting_started.md).
1732

18-
---
19-
20-
# Use cases covered
33+
## 🌟 Features
2134
You will see a number of use cases covered:
2235

23-
* Async tasks (sending email, health-check PUSH)
24-
* Viable alternatives to Celery
25-
* Sending e-mail (with SMTP)
26-
* User Login, Logout, Registration, password reset (email, social)
27-
* 2FA enabled by default
28-
* Admin interface customization
29-
* Health-check (HEAD/GET used by Load Balancers)
30-
* Simple template tags (quick image thumbnails)
31-
* Serving static assets from Django vs. needing nginx/apache
32-
* Storing assets in S3 (optional)
33-
* Local development using PyCharm and/or Docker
34-
* Command line automation with `Makefile`
35-
* Deployment with Docker and Docker Compose
36-
* Deployment to Heroku, Dokku, etc using `Procfile`
37-
* Opinionated linting and formatting with ruff
38-
* Configuration and worker management inside the admin interface
39-
* Default pages for privacy policy, terms of service
40-
* Uses bootstrap icons
36+
- **Organizations with Multi-tenancy** - Create, manage, and collaborate in organizations with fine-grained permissions
37+
- **User Invitation System** - Complete invitation lifecycle with email notifications and secure onboarding
38+
- **Modern Authentication** - Email verification, social logins, MFA/2FA support via django-allauth
39+
- **Asynchronous Task Processing** - Simple worker pattern using PostgreSQL (no Celery/Redis/RabbitMQ required)
40+
- **Docker-based Development** - Consistent development environment with Docker Compose
41+
- **Production Ready** - Configured for deployment to Dokku or similar platforms
42+
- **Strict Code Quality** - Ruff linting with strict settings, pre-commit hooks, GitHub Actions workflow
43+
- **Comprehensive Testing** - Unit and integration tests covering critical functionality
44+
- **Bootstrap 5 UI** - Clean, responsive interface with dark mode support
45+
- **Admin interface customization** - Custom admin views for managing data
46+
- **Health-check** - HEAD/GET used by Load Balancers and other services
47+
- **Simple template tags** - Custom template tags for rendering common UI elements
48+
- **Serving static assets** - from Django vs. needing nginx/apache
49+
- **Storing assets in S3** - (optional)
50+
- Local development using PyCharm and/or Docker
51+
- Command line automation with `Makefile`
52+
- Deployment with Docker and Docker Compose
53+
- Deployment to Heroku, Dokku, etc using `Procfile`
54+
- Opinionated linting and formatting with ruff
55+
- Configuration and worker management inside the admin interface
56+
- **Default pages** - for privacy policy, terms of service
4157

42-
---
4358

44-
# Project Principles
59+
## 🏗️ Architecture
60+
61+
This Django Reference Implementation follows a pragmatic approach to building SaaS applications:
62+
63+
- **Core Apps**:
64+
- `myapp`: Base application with site configuration models and templates
65+
- `organizations`: Complete multi-tenant organization system with invitations
66+
67+
- **Authentication**: Uses django-allauth for secure authentication with 2FA support
68+
69+
- **Async Processing**:
70+
- Custom worker pattern using Django management commands
71+
- Uses PostgreSQL as a task queue instead of complex message brokers
72+
- Simple to deploy, monitor, and maintain
73+
74+
75+
## 🤔 Why This Template?
76+
77+
Unlike other Django templates that are either too simplistic or bloated with features, this reference implementation:
78+
79+
- **Solves Real Business Problems** - Built based on actual production experience, not theoretical patterns
80+
- **Minimizes Dependencies** - No unnecessary packages that increase complexity and security risks
81+
- **Focuses on Multi-tenancy** - Organizations and team collaboration are first-class citizens
82+
- **Balances Structure and Flexibility** - Opinionated enough to get you started quickly, but not restrictive
83+
- **Production Mindset** - Includes monitoring, error handling, and deployment configurations
84+
85+
86+
## Project Principles
4587

4688
* Use as little abstraction as possible. It should be easy to trace the code
4789
paths and see what is going on. Therefore, we will not be using too
@@ -59,11 +101,11 @@ You will see a number of use cases covered:
59101
* SMTP Credentials
60102
* S3 Credentials (optional)
61103

62-
---
63104

64-
# Customizing the docker-compose.yml
65105

66-
## Adding more workers
106+
## Customizing the docker-compose.yml
107+
108+
### Adding more workers
67109

68110
Below is the text used for adding a worker that sends SMS messages.
69111

@@ -77,14 +119,13 @@ These workers are actually Django management commands that are run in a loop.
77119
env_file: env.sample
78120
```
79121

80-
---
81122

82-
# Developing locally
123+
## Developing locally
83124
PyCharm's integration with the debugger and Docker leaves some things to be desired.
84125
This has changed how I work on the desktop. In short, I don't use docker for the django
85126
part of development. I use the local development environment provided by MacOS.
86127

87-
## My Preferred developer stack
128+
### My Preferred developer stack
88129

89130
* [PyCharm](https://jetbrains.com/pycharm/) (paid but community version is good, too)
90131
* [Postgres](https://postgresql.org) installed via homebrew or docker
@@ -96,12 +137,12 @@ part of development. I use the local development environment provided by MacOS.
96137

97138
---
98139

99-
# Other Django Template Projects
140+
## 🔄 Similar Projects
100141
Thankfully there are many other Django template projects that you can use.
101142
We all take inspiration from each other and build upon the work of others.
102143
If this one is not to your taste, then there are others to consider:
103144

104-
## Free / OpenSource
145+
### Free / OpenSource
105146
* [cookiecutter-django](https://github.com/cookiecutter/cookiecutter-django)
106147
* [django-superapp](https://github.com/django-superapp/django-superapp)
107148
* [SaaS Boilerplate](https://github.com/apptension/saas-boilerplate)
@@ -112,23 +153,34 @@ If this one is not to your taste, then there are others to consider:
112153
* [Quickscale](https://github.com/Experto-AI/quickscale)
113154
* [Hyperion](https://github.com/eriktaveras/django-saas-boilerplate)
114155

115-
## Paid
156+
### Paid
116157
* [SaaS Pegasus](https://www.saaspegasus.com/)
117158
* [SlimSaaS](https://slimsaas.com/)
118159
* [Sneat](https://themeselection.com/item/sneat-dashboard-pro-django/)
119160

120161
*NOTE: These are not endorsements of these projects. Just examples of other
121162
ways to get started with Django.*
122163

123-
---
164+
## 📚 Documentation
165+
166+
- [Getting Started Guide](docs/getting_started.md)
167+
- [Manifesto](docs/manifesto.md)
168+
- [Organizations](src/organizations/docs/README.md)
169+
- [Asynchronous Tasks](docs/async_tasks.md)
170+
124171

125-
# Contributing
172+
## 🤝 Contributing
126173

127174
Contributions are welcome. Simply fork, submit a pull request, and explain
128175
what you would like to fix/improve.
129176

130-
---
177+
## 📜 License
178+
179+
[MIT License](LICENSE)
131180

132-
# License
181+
---
133182

134-
This code is under the MIT License
183+
<div style="text-align: center; margin-top: 20px;">
184+
<p>If this project helps you, please consider giving it a star ⭐</p>
185+
<p>Developed and maintained by <a href="https://simplecto.com">SimpleCTO</a></p>
186+
</div>

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
ruff==0.11.6
1+
ruff==0.11.8
22
pre-commit==4.2.0
33
flit==3.12.0

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
asgiref==3.8.1
22
certifi==2025.4.26
3-
charset-normalizer==3.4.1
3+
charset-normalizer==3.4.2
44
django-environ==0.12.0
55
Django==5.1.8
66
django-allauth[mfa]==65.7.0

src/myapp/management/commands/_base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,8 @@ def handle(self, *args, **options) -> None: # noqa: ANN002, ANN003, ARG002
109109
"Sleeping for %d seconds.",
110110
self.config.sleep_seconds,
111111
)
112-
time.sleep(self.config.sleep_seconds)
112+
113+
for _ in range(self.config.sleep_seconds):
114+
if not self.keep_running:
115+
break
116+
time.sleep(1)

0 commit comments

Comments
 (0)