(venv2) D:\gits\django-rest-framework-mongoengine-example\project>python manage.py createsuperuser
Using a default mongo database
Username: test1
Email: test1@163.com
Password:
Password (again):
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "D:\tools\python36\venv2\lib\site-packages\django\core\management__init__.py", line 350, in execute_from_command_line
utility.execute()
File "D:\tools\python36\venv2\lib\site-packages\django\core\management__init__.py", line 342, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\tools\python36\venv2\lib\site-packages\django\core\management\base.py", line 348, in run_from_argv
self.execute(*args, cmd_options)
File "D:\tools\python36\venv2\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 52, in execute
return super(Command, self).execute(*args, *options)
File "D:\tools\python36\venv2\lib\site-packages\django\core\management\base.py", line 399, in execute
output = self.handle(args, options)
File "D:\tools\python36\venv2\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 173, in handle
self.UserModel._default_manager.db_manager(database).create_superuser(user_data)
File "D:\tools\python36\venv2\lib\site-packages\django\contrib\auth\models.py", line 165, in create_superuser
return self._create_user(username, email, password, extra_fields)
File "D:\tools\python36\venv2\lib\site-packages\django\contrib\auth\models.py", line 147, in _create_user
user.set_password(password)
File "D:\gits\django-rest-framework-mongoengine-example\project\users\models.py", line 86, in set_password
self.save()
File "D:\tools\python36\venv2\lib\site-packages\mongoengine\document.py", line 285, in save
self.validate(clean=clean)
File "D:\tools\python36\venv2\lib\site-packages\mongoengine\base\document.py", line 411, in validate
raise ValidationError(message, errors=errors)
mongoengine.errors.ValidationError: ValidationError (User:None) (Field is required: ['id'])
Default django authentication system won't work with Mongoengine. With Mongoengine versions under 0.9 you have a django app that might provide some admin management commands.
(venv2) D:\gits\django-rest-framework-mongoengine-example\project>python manage.py createsuperuser Using a default mongo database Username: test1 Email: test1@163.com Password: Password (again): Traceback (most recent call last): File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "D:\tools\python36\venv2\lib\site-packages\django\core\management__init__.py", line 350, in execute_from_command_line
utility.execute()
File "D:\tools\python36\venv2\lib\site-packages\django\core\management__init__.py", line 342, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\tools\python36\venv2\lib\site-packages\django\core\management\base.py", line 348, in run_from_argv
self.execute(*args, cmd_options)
File "D:\tools\python36\venv2\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 52, in execute
return super(Command, self).execute(*args, *options)
File "D:\tools\python36\venv2\lib\site-packages\django\core\management\base.py", line 399, in execute
output = self.handle(args, options)
File "D:\tools\python36\venv2\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 173, in handle
self.UserModel._default_manager.db_manager(database).create_superuser(user_data)
File "D:\tools\python36\venv2\lib\site-packages\django\contrib\auth\models.py", line 165, in create_superuser
return self._create_user(username, email, password, extra_fields)
File "D:\tools\python36\venv2\lib\site-packages\django\contrib\auth\models.py", line 147, in _create_user
user.set_password(password)
File "D:\gits\django-rest-framework-mongoengine-example\project\users\models.py", line 86, in set_password
self.save()
File "D:\tools\python36\venv2\lib\site-packages\mongoengine\document.py", line 285, in save
self.validate(clean=clean)
File "D:\tools\python36\venv2\lib\site-packages\mongoengine\base\document.py", line 411, in validate
raise ValidationError(message, errors=errors)
mongoengine.errors.ValidationError: ValidationError (User:None) (Field is required: ['id'])