[GH-ISSUE #1165] createsuperuser throws a AttributeError #957

Closed
opened 2026-02-27 11:14:27 +03:00 by kerem · 0 comments
Owner

Originally created by @SweBarre on GitHub (Jun 30, 2017).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/1165

Originally assigned to: @tonioo on GitHub.

trying to add a superuser with manage.py createsuperuser, but it craches

root@9cd49d0eb297:/srv/instance# python manage.py createsuperuser
Username: admin
Email: admin@example.com
Password: 
Password (again): 
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 63, in execute
    return super(Command, self).execute(*args, **options)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 183, in handle
    self.UserModel._default_manager.db_manager(database).create_superuser(**user_data)
  File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/models.py", line 168, in create_superuser
    return self._create_user(username, email, password, **extra_fields)
  File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/models.py", line 148, in _create_user
    username = self.model.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'
root@9cd49d0eb297:/srv/instance# python --version && pip show modoboa
Python 2.7.13
Name: modoboa
Version: 1.7.4
Summary: Mail hosting made simple
Home-page: http://modoboa.org/
Author: Antoine Nguyen
Author-email: tonio@ngyn.org
License: ISC
Location: /usr/local/lib/python2.7/site-packages
Requires: django, django-ckeditor, django-passwords, django-reversion, django-subcommand2, django-versionfield2, django-xforwardedfor-middleware, dj-database-url, coreapi, coreapi-cli, djangorestframework, argparse, bcrypt, dnspython, feedparser, gevent, ipaddress, jsonfield, passlib, progressbar, py-dateutil, pycrypto, pytz, requests, rfc6266

Impacted versions

  • Modoboa: 2.7.13
  • installer used: No
  • Webserver: N/A

Steps to reproduce

install version 2.7.13 through modoboa-admin.py deploy
run: python manage.py createsuperuser

Current behavior

throws a AttributeError: type object 'User' has no attribute 'normalize_username'

Expected behavior

adds a new superuser

Originally created by @SweBarre on GitHub (Jun 30, 2017). Original GitHub issue: https://github.com/modoboa/modoboa/issues/1165 Originally assigned to: @tonioo on GitHub. trying to add a superuser with manage.py createsuperuser, but it craches ``` root@9cd49d0eb297:/srv/instance# python manage.py createsuperuser Username: admin Email: admin@example.com Password: Password (again): Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 63, in execute return super(Command, self).execute(*args, **options) File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute output = self.handle(*args, **options) File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 183, in handle self.UserModel._default_manager.db_manager(database).create_superuser(**user_data) File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/models.py", line 168, in create_superuser return self._create_user(username, email, password, **extra_fields) File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/models.py", line 148, in _create_user username = self.model.normalize_username(username) AttributeError: type object 'User' has no attribute 'normalize_username' root@9cd49d0eb297:/srv/instance# python --version && pip show modoboa Python 2.7.13 Name: modoboa Version: 1.7.4 Summary: Mail hosting made simple Home-page: http://modoboa.org/ Author: Antoine Nguyen Author-email: tonio@ngyn.org License: ISC Location: /usr/local/lib/python2.7/site-packages Requires: django, django-ckeditor, django-passwords, django-reversion, django-subcommand2, django-versionfield2, django-xforwardedfor-middleware, dj-database-url, coreapi, coreapi-cli, djangorestframework, argparse, bcrypt, dnspython, feedparser, gevent, ipaddress, jsonfield, passlib, progressbar, py-dateutil, pycrypto, pytz, requests, rfc6266 ``` # Impacted versions * Modoboa: 2.7.13 * installer used: No * Webserver: N/A # Steps to reproduce install version 2.7.13 through modoboa-admin.py deploy run: python manage.py createsuperuser # Current behavior throws a AttributeError: type object 'User' has no attribute 'normalize_username' # Expected behavior adds a new superuser
kerem 2026-02-27 11:14:27 +03:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#957
No description provided.