Creating superuser - problem with documentation or it's just me?
Hi,
In my quest to create a superuser, I followed another HOWTO - https://docs.mailman3.org/en/latest/devsetup.html
(venv) [root@gw /opt/mailman/git/mailman-suite/mailman-suite_project]# python manage.py migrate Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/mailman/mm/venv/lib/python3.7/site-packages/Django-3.0.8-py3.7.egg/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/opt/mailman/mm/venv/lib/python3.7/site-packages/Django-3.0.8-py3.7.egg/django/core/management/__init__.py", line 377, in execute django.setup() File "/opt/mailman/mm/venv/lib/python3.7/site-packages/Django-3.0.8-py3.7.egg/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/opt/mailman/mm/venv/lib/python3.7/site-packages/Django-3.0.8-py3.7.egg/django/apps/registry.py", line 114, in populate app_config.import_models() File "/opt/mailman/mm/venv/lib/python3.7/site-packages/Django-3.0.8-py3.7.egg/django/apps/config.py", line 211, in import_models self.models_module = import_module(models_module_name) File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 728, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/opt/mailman/git/hyperkitty/hyperkitty/models/__init__.py", line 25, in <module> from .category import ThreadCategory File "/opt/mailman/git/hyperkitty/hyperkitty/models/category.py", line 61, in <module> class ThreadCategory(models.Model): File "/opt/mailman/mm/venv/lib/python3.7/site-packages/Django-3.0.8-py3.7.egg/django/db/models/base.py", line 121, in __new__ new_class.add_to_class('_meta', Options(meta, app_label)) File "/opt/mailman/mm/venv/lib/python3.7/site-packages/Django-3.0.8-py3.7.egg/django/db/models/base.py", line 325, in add_to_class value.contribute_to_class(cls, name) File "/opt/mailman/mm/venv/lib/python3.7/site-packages/Django-3.0.8-py3.7.egg/django/db/models/options.py", line 208, in contribute_to_class self.db_table = truncate_name(self.db_table, connection.ops.max_name_length()) File "/opt/mailman/mm/venv/lib/python3.7/site-packages/Django-3.0.8-py3.7.egg/django/db/__init__.py", line 28, in __getattr__ return getattr(connections[DEFAULT_DB_ALIAS], item) File "/opt/mailman/mm/venv/lib/python3.7/site-packages/Django-3.0.8-py3.7.egg/django/db/utils.py", line 207, in __getitem__ backend = load_backend(db['ENGINE']) File "/opt/mailman/mm/venv/lib/python3.7/site-packages/Django-3.0.8-py3.7.egg/django/db/utils.py", line 111, in load_backend return import_module('%s.base' % backend_name) File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/opt/mailman/mm/venv/lib/python3.7/site-packages/Django-3.0.8-py3.7.egg/django/db/backends/sqlite3/base.py", line 14, in <module> from sqlite3 import dbapi2 as Database File "/usr/local/lib/python3.7/sqlite3/__init__.py", line 23, in <module> from sqlite3.dbapi2 import * File "/usr/local/lib/python3.7/sqlite3/dbapi2.py", line 27, in <module> from _sqlite3 import * ModuleNotFoundError: No module named '_sqlite3' *<==============================================================* (venv) [root@gw /opt/mailman/git/mailman-suite/mailman-suite_project]# pip install pysqlite3 Collecting pysqlite3 Using cached pysqlite3-0.4.3.tar.gz (40 kB) Building wheels for collected packages: pysqlite3 Building wheel for pysqlite3 (setup.py) ... done WARNING: Legacy build of wheel for 'pysqlite3' created no files. Command arguments: /opt/mailman/mm/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ge24cqof/pysqlite3/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ge24cqof/pysqlite3/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-ou7p1uhx Command output: [use --verbose to show] Running setup.py clean for pysqlite3 Failed to build pysqlite3 Installing collected packages: pysqlite3 Running setup.py install for pysqlite3 ... done Successfully installed pysqlite3 <==============================================================
But even after that, the error about *'ModuleNotFoundError: No module named '_sqlite3'* still persists..
How does one solve this issue??
So I figured out that I need to put my own settings_local.py into the directory and let the command rely on MySQL as the database backend since by default, it uses sqlite3 backend.
But the question then is WHY is this not documented on the above page???
How can I delete the superuser after creating it??
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", grep ^[^#] :-)
On 7/26/20 9:39 AM, Odhiambo Washington wrote:
Hi,
In my quest to create a superuser, I followed another HOWTO - https://docs.mailman3.org/en/latest/devsetup.html
(venv) [root@gw /opt/mailman/git/mailman-suite/mailman-suite_project]# python manage.py migrate Traceback (most recent call last):
manage.py migrate (or django-admin migrate) is part if the mailman-post-update script. It doesn't work here because when you run it this way, it doesn't get your settings.py.
ModuleNotFoundError: No module named '_sqlite3'
And it's looking for sqlite3 because that's the default database.
*<==============================================================* (venv) [root@gw /opt/mailman/git/mailman-suite/mailman-suite_project]# pip install pysqlite3
You don't need this. You need to run django-admin with the correct settings.
So I figured out that I need to put my own settings_local.py into the directory and let the command rely on MySQL as the database backend since by default, it uses sqlite3 backend.
But the question then is WHY is this not documented on the above page???
Because that's not relevant to what you are doing. You are trying to install Mailman for production, not development.
How can I delete the superuser after creating it??
The only django-admin or manage.py you should run is
/opt/mailman/mm/bin/djhango-admin. You can run django-admin createsuperuser
to create a superuser. If you want to delete one, you
need to go to the Django admin web UI - should be
http://your.server/admin - login as a superuser and go to the Users page
and delete it. You should probably do this as a different superuser
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On Mon, 27 Jul 2020 at 02:01, Mark Sapiro <mark@msapiro.net> wrote:
On 7/26/20 9:39 AM, Odhiambo Washington wrote:
Hi,
In my quest to create a superuser, I followed another HOWTO - https://docs.mailman3.org/en/latest/devsetup.html
(venv) [root@gw /opt/mailman/git/mailman-suite/mailman-suite_project]# python manage.py migrate Traceback (most recent call last):
manage.py migrate (or django-admin migrate) is part if the mailman-post-update script. It doesn't work here because when you run it this way, it doesn't get your settings.py.
I have taken note of that. Thank you.
ModuleNotFoundError: No module named '_sqlite3'
*<==============================================================* (venv) [root@gw /opt/mailman/git/mailman-suite/mailman-suite_project]#
And it's looking for sqlite3 because that's the default database. pip
install pysqlite3
You don't need this. You need to run django-admin with the correct settings.
Thanks for clarifying.
So I figured out that I need to put my own settings_local.py into the
directory and let the command rely on MySQL as the database backend since by default, it uses sqlite3 backend.
But the question then is WHY is this not documented on the above page???
Because that's not relevant to what you are doing. You are trying to install Mailman for production, not development.
Okay. That is true.
How can I delete the superuser after creating it??
The only django-admin or manage.py you should run is /opt/mailman/mm/bin/djhango-admin. You can run
django-admin createsuperuser
to create a superuser. If you want to delete one, you need to go to the Django admin web UI - should be http://your.server/admin - login as a superuser and go to the Users page and delete it. You should probably do this as a different superuser
The reason I asked for how to delete superuser came from the fact that from the above confusion, I needed to create a superuser.
So now I have tried to see if there is such option from django-admin, but:
(venv) [root@gw /opt/mailman/mm]# django-admin --help
Type 'django-admin help <subcommand>' for help on a specific subcommand.
Available subcommands:
[django] check compilemessages createcachetable dbshell diffsettings dumpdata flush inspectdb loaddata makemessages makemigrations migrate runserver sendtestemail shell showmigrations sqlflush sqlmigrate sqlsequencereset squashmigrations startapp startproject test testserver *Note that only Django core commands are listed as settings are not properly configured (error: 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.).* (venv) [root@gw /opt/mailman/mm]#
So is something wrong with my settings???? I do not see the command to create the superuser listed.
My settings_local.py has got only the bits from settings.py that I have customized.
Thank you for your patience.
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", grep ^[^#] :-)
On 7/27/20 6:48 AM, Odhiambo Washington wrote:
So now I have tried to see if there is such option from django-admin, but:
(venv) [root@gw /opt/mailman/mm]# django-admin --help
You must run /opt/mailman/mm/bin/django-admin. If you run these commands in your venv, you run the ones in /opt/mailman/mm/venv/bin which dont have all the pointers to configuration and settings. It's OK to run /opt/mailman/mm/bin/* with your venv active, but if you just give the command name, you get the wring one.
You also must have the empty /opt/mailman/mm/__init__py so that imports of /opt/mailman/mm*.py modules will work as I said at <https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/message/UVM5OTO5SUMWVVKUB6KX7XL6RRPOCRKW/>
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On Tue, 28 Jul 2020 at 07:03, Mark Sapiro <mark@msapiro.net> wrote:
On 7/27/20 6:48 AM, Odhiambo Washington wrote:
So now I have tried to see if there is such option from django-admin, but:
(venv) [root@gw /opt/mailman/mm]# django-admin --help
You must run /opt/mailman/mm/bin/django-admin. If you run these commands in your venv, you run the ones in /opt/mailman/mm/venv/bin which dont have all the pointers to configuration and settings. It's OK to run /opt/mailman/mm/bin/* with your venv active, but if you just give the command name, you get the wring one.
So, I should run /opt/mailman/mm/bin/django-admin with a valid argument, right? Like /opt/mailman/mm/bin/django-admin createsuperuser ... How do I get all the available arguments for django-admin? That is what I was attempting to do by passing --help to it.
You also must have the empty /opt/mailman/mm/__init__py so that imports of /opt/mailman/mm*.py modules will work as I said at < https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/message/...
This is quite clear now. Thank you. It wasn't clear at what point in the installation process this file needs to be created.
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", grep ^[^#] :-)
On 7/28/20 2:16 AM, Odhiambo Washington wrote:
So, I should run /opt/mailman/mm/bin/django-admin with a valid argument, right? Like /opt/mailman/mm/bin/django-admin createsuperuser ... How do I get all the available arguments for django-admin? That is what I was attempting to do by passing --help to it.
/opt/mailman/mm/bin/django-admin
with --help or no arguments at all.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (2)
-
Mark Sapiro
-
Odhiambo Washington