On May 12, 2020, at 3:46 PM, Mark Sapiro <mark@msapiro.net> wrote:
On 5/12/20 3:02 PM, Mark Dadgar wrote:
The second patch did not work either. Ahh, well.
I think you need to do something like this:
$ mm/bin/django-admin shell Python 3.7.1 (default, Dec 14 2018, 13:17:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole)
from hyperkitty.models import Email emails = Email.objects.all() for email in emails: ... if email.content.find('\u200b'*5) >= 0: ... print('Found in ml {}, hash {}'.format( ... email.mailinglist.name, ... email.message_id_hash)) ... _NAME/message/HASH/
Finally getting around to looking into this now that I’ve migrated from sqlite3 to postgres (writeup on that coming soon for the archives).
Here’s what I get when I attempt the above commands:
root@mail:/usr/lib/mailman3/bin# sudo -u list django-admin shell Python 3.8.2 (default, Apr 27 2020, 15:53:34) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole)
from hyperkitty.models import Email Traceback (most recent call last): File "/usr/lib/python3.8/code.py", line 90, in runcode exec(code, self.locals) File "<console>", line 1, in <module> File "/usr/lib/python3/dist-packages/hyperkitty/models/__init__.py", line 25, in <module> from .category import ThreadCategory File "/usr/lib/python3/dist-packages/hyperkitty/models/category.py", line 61, in <module> class ThreadCategory(models.Model): File "/usr/lib/python3/dist-packages/django/db/models/base.py", line 103, in __new__ app_config = apps.get_containing_app_config(module) File "/usr/lib/python3/dist-packages/django/apps/registry.py", line 252, in get_containing_app_config self.check_apps_ready() File "/usr/lib/python3/dist-packages/django/apps/registry.py", line 134, in check_apps_ready settings.INSTALLED_APPS File "/usr/lib/python3/dist-packages/django/conf/__init__.py", line 79, in __getattr__ self._setup(name) File "/usr/lib/python3/dist-packages/django/conf/__init__.py", line 60, in _setup 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.
I am in no way a django expert.
Thoughts?
- Mark
mark@pdc-racing.net | 408-348-2878