A Python package for managing Django application workers using InterpreterPoolExecutor
Project description
Django Melnottam
⚠️ EXPERIMENTAL - This library is still in early development. APIs are subject to change without notice. Use at your own risk and with caution in production environments.
A Python package for managing Django application workers using InterpreterPoolExecutor from Python 3.14+.
This package provides a clean abstraction for running web and task workers in isolated Python interpreters.
Intention
This library simplifies Django deployment by running web and task workers in a single process
Rather than managing separate services, you get a unified, straightforward deployment experience.
We've selected sensible defaults—including django-tasks-db for task queuing and django-prodserver for the production server—to create a plug-and-play system that integrates seamlessly with your existing Django applications.
Overview
django-melnottam manages multiple worker processes using Python 3.14's concurrent.futures.InterpreterPoolExecutor. It provides:
- Web Workers: ASGI/WSGI application servers using Hypercorn
- Task Workers: Django task queue workers using
django-tasks-db - Isolated Execution: Each worker runs in its own Python interpreter, avoiding GIL contention
- Graceful Shutdown: Coordinated shutdown with timeout handling
- Signal Management: Proper SIGINT handling and cleanup
Requirements
- Python 3.14+
- Django 6.0+
django-tasks-db >= 0.12.0django-prodserver>=2.4.0hypercorn >= 0.18.0
Installation
From Pip
pip install django-melnottam
Preferred Deployment
This library includes a built-in django-prodserver backend that provides the recommended way to deploy your Django application with web and task workers.
Deployment Command
To use the preferred deployment method with django-prodserver, run the following command with environment variable substitution:
BIND_ADDRESS="0.0.0.0:$PORT" WORKERS="$WORKERS" TASK_WORKERS="$INSTANCE_TASK_WORKERS" python manage.py prodserver web-with-task-worker
Configuration in Django Settings
Ensure your settings.py includes the production process configuration:
from django_melnottam.config import PositiveIntegerValue, Value
INSTALLED_APPS = [
# ...
"django_tasks_db",
"django_prodserver",
# ...
]
TASKS = {
"default": {
"BACKEND": "django_tasks_db.DatabaseBackend",
"QUEUES": ["default"],
}
}
# Production process configuration with command-line parameter support
PRODUCTION_PROCESSES = {
"web-with-task-worker": {
"BACKEND": "django_melnottam.prodserver_backends.subinterpreter.SubinterpreterWorkerServer",
"ARGS": {
"app_path": "myapp.wsgi:application",
"django_settings_module": "myapp.settings",
"workers": WORKERS,
"task_workers": TASK_WORKERS,
"bind": BIND_ADDRESS,
},
},
}
Environment Variables
PORT: The port to bind to (e.g.,8000)WORKERS: Number of web workers (e.g.,4)INSTANCE_TASK_WORKERS: Number of task workers (e.g.,2)
Usage
Command Line Interface
django-melnottam-cli <application> [options]
Arguments
application: Path to your WSGI application (e.g.,myapp.wsgi:application)
Options
-w, --workers: Number of web workers (default: 2)-t, --task-workers: Number of task workers (default: 1)-b, --bind: Bind address for web server (default:0.0.0.0:9001)-s, --settings: Django settings module (default: fromDJANGO_SETTINGS_MODULEenv var)-v, --verbose: Enable debug logging
Example
django-melnottam-cli myapp.wsgi:application \
--workers 4 \
--task-workers 2 \
--bind 0.0.0.0:8000 \
--settings myapp.settings.production
Programmatic Usage
from django_melnottam.manager import run_application
run_application(
app_path="myapp.wsgi:application",
workers=4,
task_workers=2,
bind="0.0.0.0:8000",
django_settings_module="myapp.settings"
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_melnottam-0.1.1.tar.gz.
File metadata
- Download URL: django_melnottam-0.1.1.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e910dbfbda5a18833b7ccdb5dad87725cce174ab1899295fe3afc6fa8346a888
|
|
| MD5 |
d354515a590f9f93ca11275e579b72ef
|
|
| BLAKE2b-256 |
4bb664faf3d332584abdcabae922bebe886e7d2b4ae01169a63dbff94c5358d4
|
File details
Details for the file django_melnottam-0.1.1-py3-none-any.whl.
File metadata
- Download URL: django_melnottam-0.1.1-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0537a16c8dbb31324726acb0286cf58bab1e96c0a86c264e6335bd5f40afc855
|
|
| MD5 |
2f8a81cb7b115ce17a978867d19e8a50
|
|
| BLAKE2b-256 |
f4f3ae855a6946bbb20e0a2b129da1d08435d47d344e547bb503d621eae30ebf
|