What would a prodserver do?

The idea of a prodserver command has been buzzing in my head so I am putting pen to paper to work out what it might look like. As mentioned yesterday django-webserver has an excellent start in this space by providing four management commands, each for a separate wsgi server. However what I don't like about this is that it lacks a clear common interface when running the actual command.

While reviewing the django-webserver code, another consideration the pops out is how to handle the installation of the wsgi/asgi servers themselves and then the interfacing to those servers within the python code. The crux here is to provide a clear API that allows for easy extension to other servers without much friction otherwise, it's not much of an improvement.

Finally I do want the command to be able to specify multiple servers. For example running a WSGI and ASGI server in the same project or perhaps other background workers. Here a similar interface to running docker compose comes to mind, for example:

./manage.py prodserver web-sync
./manage.py prodserver web-async
./manage.py prodserver worker

Where the names are user specified in settings, which might look like this:

# could be a list instead of a dictionary
  'web-sync': {
    "BACKEND": 'prodserver.wsgi.gunicorn.GunicornServer'
    'OPTIONS': {
      'ARGS': [...],



where the GunicornServer class could look like:

# borrowed from django-webserver
class GunicornServer(BaseProdServer):

  def start_server(self, *args):
    DjangoApplication("%(prog)s [OPTIONS]").run()