Skip to content

Dispatcharr 0.13.1 requires new environment variable DJANGO_SECRET_KEYΒ #9728

@tobbi007

Description

@tobbi007

βœ… Have you read and understood the above guidelines?

yes

πŸ”Ž Did you run the script with verbose mode enabled?

Yes, verbose mode was enabled and the output is included below

πŸ“œ What is the name of the script you are using?

Dispatcharr

πŸ“‚ What was the exact command used to execute the script?

update

βš™οΈ What settings are you using?

  • Default Settings
  • Advanced Settings

πŸ–₯️ Which Linux distribution are you using?

Debian 13

πŸ“ˆ Which Proxmox version are you on?

9.1.1

πŸ“ Provide a clear and concise description of the issue.

The latest Dispatcharr release (v0.13.1) introduced a mandatory new environment variable (DJANGO_SECRET_KEY) that must be present in the .env file for the application to start correctly.

When users update the container using the existing Proxmox community update script function, the script pulls the new application code but does not add the variable to the .env file. This results in a broken/unresponsive container immediately after the update completes.

The update function in the community script needs modification to automatically inject the DJANGO_SECRET_KEY into the /opt/dispatcharr/.env file before restarting the service with the new codebase.

πŸ”„ Steps to reproduce the issue.

Start with a working Dispatcharr 0.13.0 LXC container deployed via the community script.
Ensure the current /opt/dispatcharr/.env file does not contain DJANGO_SECRET_KEY
Execute the update function.
The script errors out.
The Dispatcharr web interface is now unreachable/broken

❌ Paste the full error output (if available).

Traceback (most recent call last):
  File "/opt/dispatcharr/manage.py", line 19, in <module>
    main()
    ~~~~^^
  File "/opt/dispatcharr/manage.py", line 16, in main
    execute_from_command_line(sys.argv)
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
    ~~~~~~~~~~~~~~~^^
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/django/core/management/base.py", line 416, in run_from_argv
    self.execute(*args, **cmd_options)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/django/core/management/base.py", line 457, in execute
    self.check(**check_kwargs)
    ~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/django/core/management/base.py", line 492, in check
    all_issues = checks.run_checks(
        app_configs=app_configs,
    ...<2 lines>...
        databases=databases,
    )
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/django/core/checks/registry.py", line 89, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/django/core/checks/urls.py", line 136, in check_custom_error_handlers
    handler = resolver.resolve_error_handler(status_code)
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/django/urls/resolvers.py", line 732, in resolve_error_handler
    callback = getattr(self.urlconf_module, "handler%s" % view_type, None)
                       ^^^^^^^^^^^^^^^^^^^
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/django/utils/functional.py", line 47, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
                                         ~~~~~~~~~^^^^^^^^^^
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/django/urls/resolvers.py", line 711, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/opt/dispatcharr/dispatcharr/urls.py", line 7, in <module>
    from drf_yasg.views import get_schema_view
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/drf_yasg/views.py", line 10, in <module>
    from rest_framework.views import APIView
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/rest_framework/views.py", line 18, in <module>
    from rest_framework.schemas import DefaultSchema
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/rest_framework/schemas/__init__.py", line 33, in <module>
    authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES,
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/rest_framework/settings.py", line 227, in __getattr__
    val = perform_import(val, attr)
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/rest_framework/settings.py", line 170, in perform_import
    return [import_from_string(item, setting_name) for item in val]
            ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/rest_framework/settings.py", line 179, in import_from_string
    return import_string(val)
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/django/utils/module_loading.py", line 30, in import_string
    return cached_import(module_path, class_name)
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/django/utils/module_loading.py", line 15, in cached_import
    module = import_module(module_path)
  File "/usr/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/rest_framework_simplejwt/authentication.py", line 10, in <module>
    from .models import TokenUser
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/rest_framework_simplejwt/models.py", line 7, in <module>
    from .settings import api_settings
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/rest_framework_simplejwt/settings.py", line 20, in <module>
    "SIGNING_KEY": settings.SECRET_KEY,
                   ^^^^^^^^^^^^^^^^^^^
  File "/opt/dispatcharr/.venv/lib/python3.13/site-packages/django/conf/__init__.py", line 90, in __getattr__
    raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
  βœ–οΈ   in line 110: exit code 1 (General error / Operation not permitted): while executing command  uv run python manage.py migrate --noinput

πŸ–ΌοΈ Additional context (optional).

The current workaround for users (and the logic that should be implemented into the update script) is as follows:

Before running the general update function, access the LXC console.
Open the environment file:
nano /opt/dispatcharr/.env

Append the required key at the end of the file using a generated, random string:
DJANGO_SECRET_KEY=[generate a long random string here]

Save the file

After this manual edit, the community script update function runs successfully.

If you already broke your container and you do not have a backup. A user on a Discord reported you can also add the variable as described to a broken container, then reboot and Dispatcharr starts up again.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions