Skip to content

Add django-prodserver as a dependency#6186

Open
nanorepublica wants to merge 8 commits into
cookiecutter:mainfrom
nanorepublica:feature/django-prodserver
Open

Add django-prodserver as a dependency#6186
nanorepublica wants to merge 8 commits into
cookiecutter:mainfrom
nanorepublica:feature/django-prodserver

Conversation

@nanorepublica

@nanorepublica nanorepublica commented Nov 19, 2025

Copy link
Copy Markdown

Description

django-prodserver is a package to centrally define the production processes to provide an interface to start them via a management command. This PR adds the necessary changes to settings and updates the scripts

Checklist:

  • I've made sure that tests are updated accordingly (especially if adding or updating a template option)
  • I've updated the documentation or confirm that my change doesn't require any updates

Rationale

@nanorepublica
nanorepublica force-pushed the feature/django-prodserver branch from 16b8d21 to 6103b4a Compare November 19, 2025 20:00
@nanorepublica
nanorepublica marked this pull request as ready for review November 19, 2025 20:20
Comment thread {{cookiecutter.project_slug}}/Procfile Outdated
Comment thread {{cookiecutter.project_slug}}/config/settings/production.py Outdated
Comment on lines +4 to +5
worker: REMAP_SIGTERM=SIGQUIT python manage.py prodserver worker
beat: REMAP_SIGTERM=SIGQUIT python manage.py prodserver beat

@browniebroke browniebroke Dec 18, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I tried to deploy that to heroku and I'm getting some errors (Sentry public link)

Logs

Worker process:

heroku/worker.1 Starting process with command `REMAP_SIGTERM=SIGQUIT python manage.py prodserver worker`
heroku/worker.1 State changed from starting to up
app/worker.1 Starting server named worker
app/worker.1 Traceback (most recent call last):
app/worker.1   File "/app/manage.py", line 30, in <module>
app/worker.1     main()
app/worker.1     ~~~~^^
app/worker.1   File "/app/manage.py", line 26, in main
app/worker.1     execute_from_command_line(sys.argv)
app/worker.1     ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
app/worker.1   File "/app/.heroku/python/lib/python3.13/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
app/worker.1     utility.execute()
app/worker.1     ~~~~~~~~~~~~~~~^^
app/worker.1   File "/app/.heroku/python/lib/python3.13/site-packages/django/core/management/__init__.py", line 436, in execute
app/worker.1     self.fetch_command(subcommand).run_from_argv(self.argv)
app/worker.1     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
app/worker.1   File "/app/.heroku/python/lib/python3.13/site-packages/django_prodserver/management/commands/prodserver.py", line 64, in run_from_argv
app/worker.1     self.start_server(*args, **cmd_options)
app/worker.1     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
app/worker.1   File "/app/.heroku/python/lib/python3.13/site-packages/django_prodserver/management/commands/prodserver.py", line 102, in start_server
app/worker.1     backend.start_server(*backend.prep_server_args())
app/worker.1     ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/worker.1   File "/app/.heroku/python/lib/python3.13/site-packages/django_prodserver/backends/celery.py", line 18, in start_server
app/worker.1     self.app.Worker(*args).start()
app/worker.1     ~~~~~~~~~~~~~~~^^^^^^^
app/worker.1   File "/app/.heroku/python/lib/python3.13/site-packages/celery/worker/worker.py", line 94, in __init__
app/worker.1     self.app.loader.init_worker()
app/worker.1     ^^^^^^^^^^^^^^^
app/worker.1 AttributeError: 'str' object has no attribute 'loader'. Did you mean: 'lower'?
app/worker.1 Sentry is attempting to send 2 pending events
app/worker.1 Waiting up to 2 seconds
app/worker.1 Press Ctrl-C to quit
heroku/worker.1 State changed from up to crashed
heroku/worker.1 Process exited with status 1

Beat process:

app/beat.1 Starting server named beat
app/beat.1 Traceback (most recent call last):
app/beat.1   File "/app/manage.py", line 30, in <module>
app/beat.1     main()
app/beat.1     ~~~~^^
app/beat.1   File "/app/manage.py", line 26, in main
app/beat.1     execute_from_command_line(sys.argv)
app/beat.1     ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
app/beat.1   File "/app/.heroku/python/lib/python3.13/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
app/beat.1     utility.execute()
app/beat.1     ~~~~~~~~~~~~~~~^^
app/beat.1   File "/app/.heroku/python/lib/python3.13/site-packages/django/core/management/__init__.py", line 436, in execute
app/beat.1     self.fetch_command(subcommand).run_from_argv(self.argv)
app/beat.1     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
app/beat.1   File "/app/.heroku/python/lib/python3.13/site-packages/django_prodserver/management/commands/prodserver.py", line 64, in run_from_argv
app/beat.1     self.start_server(*args, **cmd_options)
app/beat.1     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
app/beat.1   File "/app/.heroku/python/lib/python3.13/site-packages/django_prodserver/management/commands/prodserver.py", line 102, in start_server
app/beat.1     backend.start_server(*backend.prep_server_args())
app/beat.1     ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/beat.1   File "/app/.heroku/python/lib/python3.13/site-packages/django_prodserver/backends/celery.py", line 26, in start_server
app/beat.1     self.app.Beat(*args).start()
app/beat.1     ^^^^^^^^^^^^^^^^^^^^^^^^^^
app/beat.1 AttributeError: 'Beat' object has no attribute 'start'
app/beat.1 Sentry is attempting to send 2 pending events
app/beat.1 Waiting up to 2 seconds
app/beat.1 Press Ctrl-C to quit
heroku/beat.1 State changed from up to crashed
heroku/beat.1 Process exited with status 1

That might have been due to a change in Celery... ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have a project that was possibly erroring like this when trying to add celery with prodserver. Hopefully I'll have time over Christmas to look at this!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Small update from me. Christmas came and went without progress on this bug. After Athens I'm rethinking the command names and API, so I will get that locked down and developed before pushing this any further, I wouldn't want to merge something only for it to change in the next version I release.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the update 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants