On Nov 2, 2021, at 12:51 PM, Mark Sapiro <mark@msapiro.net> wrote:
On 11/2/21 11:50 AM, bob B wrote:
So I am teaching myself to fish, and see that it is actually django-admin, so that is in mailman-web? (in docker) But i get this: $ docker exec -it mailman-web /bin/bash bash-5.0# django-admin shell Python 3.8.10 (default, May 6 2021, 06:30:44) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole)
from hyperkitty.models import MailingList Traceback (most recent call last): ... raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Do what it says. I.e. run
DJANGO_SETTINGS_MODULE=path/to/settings; django-admin shell
DJANGO_SETTINGS_MODULE expects a Python import path, instead of a filesystem path.
The docker has documentation on running management commands, which in this case is “shell” 1
$ docker exec -it mailman-web python3 manage.py shell
I know there are plethora of ways to run Django management commands, but this is the easiest one for docker.
django-admin will work too, but you have to be in the right working directory for the import path to work and it get weird. I’ve always disliked how Django management commands work unfortunately and in trying to “fix” that with “mailman-web” (which isn’t adopted by container images), i feel I might have re-invented a third option.
-- thanks, Abhilash Raj (maxking)