From django.core.management import execute_from_command_line not working

I installed paperless and want to use manage.py to mange some parts of it. I am not entierly sure how to use it exactly in nixos. However when I try to execute it from the “store”-location, I get

Traceback (most recent call last):
  File "/nix/store/b2am3b1ji5cgv1mdrz8k4mrn1lx7avpa-paperless-ngx-1.17.2/lib/paperless-ngx/src/manage.py", line 8, in <module>
    from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'

Basically I run

nix/store/b2am3b1ji5cgv1mdrz8k4mrn1lx7avpa-paperless-ngx-1.17.2/lib/paperless-ngx/src/manage.py

I have installed the following python related packages:

  • python3Full
  • python311Packages.bootstrapped-pip
  • python311Packages.pip
  • python311Packages.django

You should probably use the NixOS module instead: NixOS Search

It exposes a manage.py with all the proper environment/settings set, as /var/lib/paperless/paperless-manage (by default, if you didn’t overwrite the dataDir).

1 Like

Got it thanks, that part I missed somehow - yeah still new to NixOS, have a lo to learn