D
D
dashkevi4mike2015-06-28 17:19:10
Django
dashkevi4mike, 2015-06-28 17:19:10

Problem running createsuperuser command?

I execute the command "createsuperuser" via manage.py task in Pycharm or in the console, an error occurs

Traceback (most recent call last):
  File "/home/camaro/programming/imedrese/master/manage.py", line 14, in <module>
    execute_from_command_line(sys.argv)
  File "/home/camaro/programming/imedrese/master/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/home/camaro/programming/imedrese/master/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/camaro/programming/imedrese/master/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 190, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/home/camaro/programming/imedrese/master/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 41, in load_command_class
    return module.Command()
  File "/home/camaro/programming/imedrese/master/local/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 28, in __init__
    self.UserModel = get_user_model()
  File "/home/camaro/programming/imedrese/master/local/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 155, in get_user_model
    "AUTH_USER_MODEL refers to model '%s' that has not been installed" % settings.AUTH_USER_MODEL
django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'profile.Profile' that has not been installed

and if you run the command through the debugger, then it returns
Superuser creation skipped due to not running in a TTY. You can run `manage.py createsuperuser` in your project to create one manually.

got into the source code of the command. https://github.com/django/django/blob/master/djang...
and commented out lines 84 and 85:
if hasattr(self.stdin, 'isatty') and not self.stdin.isatty():
                    raise NotRunningInTTYException("Not running in a TTY")

As a result, the superuser was successfully created in the debugger.
What could be the problem?
user model can be viewed here (same question) Error with custom user model on django 1.8?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Afonin, 2015-12-10
@reli

Usually, in this case, dzhanga looks into the settings and expects to receive such a string there:
AUTH_USER_MODEL = 'users.User'
Which actually points to a customized user. Use :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question