Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Rename use_rq configuration to use_django_rq
  • Loading branch information
millsks committed Dec 1, 2025
commit 53fdbc9b171f47443168a302bb82caace496086b
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"use_drf": "n",
"frontend_pipeline": ["None", "Django Compressor", "Gulp", "Webpack"],
"use_celery": "n",
"use_rq": "n",
"use_django_rq": "n",
"use_mailpit": "n",
"use_sentry": "n",
"use_whitenoise": "n",
Expand Down
2 changes: 1 addition & 1 deletion docs/1-getting-started/project-generation-options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Both Gulp and Webpack support Bootstrap recompilation with real-time variables a
use_celery:
Indicates whether the project should be configured to use Celery_.

use_rq:
use_django_rq:
Indicates whether the project should be configured to use Django-RQ_ with Valkey_ as an alternative task queue to Celery. Django-RQ provides a simpler, more lightweight approach to background task processing.

use_mailpit:
Expand Down
2 changes: 1 addition & 1 deletion docs/2-local-development/developing-locally-docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ By default, it's enabled both in local and production environments (``docker-com
Django-RQ (Optional Task Queue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you selected ``use_rq`` during project initialization, you can use Django-RQ with Valkey for background task processing.
If you selected ``use_django_rq`` during project initialization, you can use Django-RQ with Valkey for background task processing.

**Services included:**

Expand Down
4 changes: 2 additions & 2 deletions docs/3-deployment/deployment-with-docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Before you begin, check out the ``docker-compose.production.yml`` file in the ro
* ``django``: your application running behind ``Gunicorn``;
* ``postgres``: PostgreSQL database with the application's relational data;
* ``redis``: Redis instance for caching (and Celery if enabled);
* ``valkey``: Valkey instance for Django-RQ task queue (if ``use_rq`` is enabled);
* ``valkey``: Valkey instance for Django-RQ task queue (if ``use_django_rq`` is enabled);
* ``traefik``: Traefik reverse proxy with HTTPS on by default.

Provided you have opted for Celery (via setting ``use_celery`` to ``y``) there are three more services:
Expand All @@ -32,7 +32,7 @@ The ``flower`` service is served by Traefik over HTTPS, through the port ``5555`

.. _`Flower`: https://github.com/mher/flower

If you have opted for Django-RQ (via setting ``use_rq`` to ``y``) there are three additional services:
If you have opted for Django-RQ (via setting ``use_django_rq`` to ``y``) there are three additional services:

* ``rqworker`` running an RQ worker process;
* ``rqscheduler`` running an RQ scheduler process;
Expand Down
2 changes: 1 addition & 1 deletion docs/4-guides/using-django-rq.rst
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy for this file to describe what's specific in our setup, but plkease avoid general explanantions about how to use django-rq. The package has docs for that (I hope), and when things will change on their end, I would like to avoid this content to go stale.

You can give a high level intro about django-rq, and explain how it's configured in the generated project, but then link to their docs please.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ When to Use Django-RQ vs Celery
Architecture
------------

When ``use_rq`` is enabled, your project includes:
When ``use_django_rq`` is enabled, your project includes:

**Services:**

Expand Down
2 changes: 1 addition & 1 deletion hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def main(): # noqa: C901, PLR0912, PLR0915
if "{{ cookiecutter.use_docker }}".lower() == "y":
remove_celery_compose_dirs()

if "{{ cookiecutter.use_rq }}".lower() == "n":
if "{{ cookiecutter.use_django_rq }}".lower() == "n":
remove_rq_files()
if "{{ cookiecutter.use_docker }}".lower() == "y":
remove_rq_compose_dirs()
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/.envs/.local/.django
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CELERY_FLOWER_USER=!!!SET CELERY_FLOWER_USER!!!
CELERY_FLOWER_PASSWORD=!!!SET CELERY_FLOWER_PASSWORD!!!
{%- endif %}

{%- if cookiecutter.use_rq == 'y' %}
{%- if cookiecutter.use_django_rq == 'y' %}
# Valkey
# ------------------------------------------------------------------------------
VALKEY_URL=valkey://valkey:6379/0
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/.envs/.production/.django
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ REDIS_URL=redis://redis:6379/0
CELERY_FLOWER_USER=!!!SET CELERY_FLOWER_USER!!!
CELERY_FLOWER_PASSWORD=!!!SET CELERY_FLOWER_PASSWORD!!!
{% endif %}
{% if cookiecutter.use_rq == 'y' %}
{% if cookiecutter.use_django_rq == 'y' %}
# Valkey
# ------------------------------------------------------------------------------
VALKEY_URL=valkey://valkey:6379/0
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/Procfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ web: gunicorn config.wsgi:application
worker: REMAP_SIGTERM=SIGQUIT celery -A config.celery_app worker --loglevel=info
beat: REMAP_SIGTERM=SIGQUIT celery -A config.celery_app beat --loglevel=info
{%- endif %}
{%- if cookiecutter.use_rq == "y" %}
{%- if cookiecutter.use_django_rq == "y" %}
worker: python manage.py rqworker default high low
scheduler: python manage.py rqscheduler
{%- endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ RUN sed -i 's/\r$//g' /start-flower
RUN chmod +x /start-flower
{% endif %}

{% if cookiecutter.use_rq == "y" %}
{% if cookiecutter.use_django_rq == "y" %}
COPY ./compose/local/django/rq/worker/start /start-rqworker
RUN sed -i 's/\r$//g' /start-rqworker
RUN chmod +x /start-rqworker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ RUN sed -i 's/\r$//g' /start-flower
RUN chmod +x /start-flower
{%- endif %}

{%- if cookiecutter.use_rq == "y" %}
{%- if cookiecutter.use_django_rq == "y" %}
COPY --chown=django:django ./compose/production/django/rq/worker/start /start-rqworker
RUN sed -i 's/\r$//g' /start-rqworker
RUN chmod +x /start-rqworker
Expand Down
6 changes: 3 additions & 3 deletions {{cookiecutter.project_slug}}/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
{%- if cookiecutter.use_celery == 'y' %}
"django_celery_beat",
{%- endif %}
{%- if cookiecutter.use_rq == 'y' %}
{%- if cookiecutter.use_django_rq == 'y' %}
"django_rq",
{%- endif %}
{%- if cookiecutter.use_drf == "y" %}
Expand Down Expand Up @@ -292,7 +292,7 @@
REDIS_URL = env("REDIS_URL", default="redis://{% if cookiecutter.use_docker == 'y' %}redis{%else%}localhost{% endif %}:6379/0")
REDIS_SSL = REDIS_URL.startswith("rediss://")
{%- endif %}
{% if cookiecutter.use_rq == 'y' -%}
{% if cookiecutter.use_django_rq == 'y' -%}
VALKEY_URL = env("VALKEY_URL", default="valkey://{% if cookiecutter.use_docker == 'y' %}valkey{%else%}localhost{% endif %}:6379/0")
{%- endif %}

Expand Down Expand Up @@ -339,7 +339,7 @@
CELERY_WORKER_HIJACK_ROOT_LOGGER = False

{%- endif %}
{% if cookiecutter.use_rq == 'y' -%}
{% if cookiecutter.use_django_rq == 'y' -%}
# Django-RQ
# ------------------------------------------------------------------------------
# https://github.com/rq/django-rq
Expand Down
8 changes: 4 additions & 4 deletions {{cookiecutter.project_slug}}/docker-compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ volumes:
{{ cookiecutter.project_slug }}_local_postgres_data: {}
{{ cookiecutter.project_slug }}_local_postgres_data_backups: {}
{% if cookiecutter.use_celery == 'y' %}{{ cookiecutter.project_slug }}_local_redis_data: {}{% endif %}
{% if cookiecutter.use_rq == 'y' %}{{ cookiecutter.project_slug }}_local_valkey_data: {}{% endif %}
{% if cookiecutter.use_django_rq == 'y' %}{{ cookiecutter.project_slug }}_local_valkey_data: {}{% endif %}

services:
django:{% if cookiecutter.use_celery == 'y' or cookiecutter.use_rq == 'y' %} &django{% endif %}
django:{% if cookiecutter.use_celery == 'y' or cookiecutter.use_django_rq == 'y' %} &django{% endif %}
build:
context: .
dockerfile: ./compose/local/django/Dockerfile
Expand All @@ -16,7 +16,7 @@ services:
{%- if cookiecutter.use_celery == 'y' %}
- redis
{%- endif %}
{%- if cookiecutter.use_rq == 'y' %}
{%- if cookiecutter.use_django_rq == 'y' %}
- valkey
{%- endif %}
{%- if cookiecutter.use_mailpit == 'y' %}
Expand Down Expand Up @@ -103,7 +103,7 @@ services:
command: /start-flower

{%- endif %}
{%- if cookiecutter.use_rq == 'y' %}
{%- if cookiecutter.use_django_rq == 'y' %}

valkey:
image: docker.io/valkey/valkey:8.0
Expand Down
10 changes: 5 additions & 5 deletions {{cookiecutter.project_slug}}/docker-compose.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ volumes:
{% if cookiecutter.use_celery == 'y' %}
production_redis_data: {}
{% endif %}
{% if cookiecutter.use_rq == 'y' %}
{% if cookiecutter.use_django_rq == 'y' %}
production_valkey_data: {}
{% endif %}


services:
django:{% if cookiecutter.use_celery == 'y' or cookiecutter.use_rq == 'y' %} &django{% endif %}
django:{% if cookiecutter.use_celery == 'y' or cookiecutter.use_django_rq == 'y' %} &django{% endif %}
build:
context: .
dockerfile: ./compose/production/django/Dockerfile
Expand All @@ -41,7 +41,7 @@ services:
{%- if cookiecutter.use_celery == 'y' %}
- redis
{%- endif %}
{%- if cookiecutter.use_rq == 'y' %}
{%- if cookiecutter.use_django_rq == 'y' %}
- valkey
{%- endif %}
env_file:
Expand Down Expand Up @@ -79,7 +79,7 @@ services:
{%- if cookiecutter.use_celery == 'y' %}
- '0.0.0.0:5555:5555'
{%- endif %}
{%- if cookiecutter.use_rq == 'y' %}
{%- if cookiecutter.use_django_rq == 'y' %}
- '0.0.0.0:9181:9181'
{%- endif %}

Expand Down Expand Up @@ -108,7 +108,7 @@ services:
image: {{ cookiecutter.project_slug }}_production_flower
command: /start-flower
{%- endif %}
{%- if cookiecutter.use_rq == 'y' %}
{%- if cookiecutter.use_django_rq == 'y' %}

valkey:
image: docker.io/valkey/valkey:8.0
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ django-celery-beat==2.8.1 # https://github.com/celery/django-celery-beat
flower==2.0.1 # https://github.com/mher/flower
{%- endif %}
{%- endif %}
{%- if cookiecutter.use_rq == "y" %}
{%- if cookiecutter.use_django_rq == "y" %}
django-rq==2.10.2 # https://github.com/rq/django-rq
rq==1.16.2 # https://github.com/rq/rq
{%- if cookiecutter.use_docker == 'y' %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% if cookiecutter.use_celery == 'y' -%}
from celery import shared_task
{%- elif cookiecutter.use_rq == 'y' -%}
{%- elif cookiecutter.use_django_rq == 'y' -%}
import django_rq
{%- endif %}

Expand All @@ -9,9 +9,9 @@

{% if cookiecutter.use_celery == 'y' -%}
@shared_task()
{%- elif cookiecutter.use_rq == 'y' -%}
{%- elif cookiecutter.use_django_rq == 'y' -%}
@django_rq.job
{%- endif %}
def get_users_count():
"""A pointless {% if cookiecutter.use_celery == 'y' %}Celery{% elif cookiecutter.use_rq == 'y' %}RQ{% endif %} task to demonstrate usage."""
"""A pointless {% if cookiecutter.use_celery == 'y' %}Celery{% elif cookiecutter.use_django_rq == 'y' %}RQ{% endif %} task to demonstrate usage."""
return User.objects.count()
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
{% if cookiecutter.use_celery == 'y' -%}
from celery.result import EagerResult
{%- elif cookiecutter.use_rq == 'y' -%}
{%- elif cookiecutter.use_django_rq == 'y' -%}
import django_rq
{%- endif %}

Expand All @@ -12,15 +12,15 @@


def test_user_count(settings):
"""A basic test to execute the get_users_count {% if cookiecutter.use_celery == 'y' %}Celery{% elif cookiecutter.use_rq == 'y' %}RQ{% endif %} task."""
"""A basic test to execute the get_users_count {% if cookiecutter.use_celery == 'y' %}Celery{% elif cookiecutter.use_django_rq == 'y' %}RQ{% endif %} task."""
batch_size = 3
UserFactory.create_batch(batch_size)
{% if cookiecutter.use_celery == 'y' -%}
settings.CELERY_TASK_ALWAYS_EAGER = True
task_result = get_users_count.delay()
assert isinstance(task_result, EagerResult)
assert task_result.result == batch_size
{%- elif cookiecutter.use_rq == 'y' -%}
{%- elif cookiecutter.use_django_rq == 'y' -%}
queue = django_rq.get_queue("default", is_async=False)
job = queue.enqueue(get_users_count)
assert job.result == batch_size
Expand Down
Loading