I am trying to create a super user in production in order to access the Django admin site. But while doing so i get the below error
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/core/management/base.py", line 393, in run_from_argv
self.execute(*args, **cmd_options)
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 50, in execute
return super(Command, self).execute(*args, **options)
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/core/management/base.py", line 444, in execute
output = self.handle(*args, **options)
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 149, in handle
self.UserModel._default_manager.db_manager(database).create_superuser(**user_data)
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/contrib/auth/models.py", line 191, in create_superuser
**extra_fields)
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/contrib/auth/models.py", line 182, in _create_user
user.save(using=self._db)
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/db/models/base.py", line 734, in save
force_update=force_update, update_fields=update_fields)
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/db/models/base.py", line 762, in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/db/models/base.py", line 846, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/db/models/base.py", line 885, in _do_insert
using=using, raw=raw)
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/db/models/manager.py", line 127, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/db/models/query.py", line 920, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 974, in execute_sql
cursor.execute(sql, params)
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 129, in execute
six.reraise(utils.IntegrityError, utils.IntegrityError(*tuple(e.args)), sys.exc_info()[2])
File "/home4/techaven/virtualenv/myenv/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 124, in execute
return self.cursor.execute(query, args)
File "/opt/python27/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-linux-x86_64.egg/MySQLdb/cursors.py", line 174, in execute
File "/opt/python27/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-linux-x86_64.egg/MySQLdb/connections.py", line 36, in defaulterrorhandler
django.db.utils.IntegrityError: (1048, "Column 'last_login' cannot be null")
I already did the syncdb and created the tables in mysql. but when trying to create superuser i get the above error. I tried different documentations but none is about the create super user and how to solve this.
Any leads is highly welcome. I have been having trouble with django deployment. Thank you in advance
Since you're using the admin app, don't forget to sync all admin related apps (eg sessions, admin, auth, contenttypes).
Not:
python manage.py migrate myapp
But:
python manage.py migrate
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.