Reputation: 8608
I am trying to create a superuser to access the Django admin framework in my app. I am using Vagrant on a Windows 8.1 machine:
> ./manage.py createsuperuser
However, I get the following error:
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, i
n execute_from_command_line
utility.execute()
File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, i
n execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in ru
n_from_argv
self.execute(*args, **options.__dict__)
File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in ex
ecute
output = self.handle(*args, **options)
File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsu
peruser.py", line 141, in handle
self.UserModel._default_manager.db_manager(database).create_superuser(**user_data)
File "/vagrant/myapp/accounts/managers.py", line 52, in create_superuser
return self._create_user(email, password, True, True, **extra_fields)
File "/vagrant/myapp/accounts/managers.py", line 31, in _create_user
user.set_slug()
File "/vagrant/myapp/accounts/models.py", line 164, in set_slug
slug = slugify(self.username, max_length=50).lower()
File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/slugify/main.py", line 101, in slugify
text = join_words(words, separator, max_length)
File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/slugify/main.py", line 78, in join_words
text = next(words) # text = words.pop(0)
StopIteration
I've read elsewhere (here) and (here) that this is a "locale" issue, but my understanding this is a OSX bug and I'm on a vagrant virtual machine...?
Upvotes: 0
Views: 9809
Reputation: 3870
Using SQL Lite I removed the DB file and run the commands:
python manage.py migrate
python manage.py makemigrations
Upvotes: 0
Reputation: 558
Just Because you have not applied migrations after creating your model. So run
python manage.py makemigrations
and then
python manage.py migrate
Now migrations have been applied and you can create superuser by running
python manage.py createsuperuser
Upvotes: 0
Reputation: 21
I faced the same problem, after migrating the changes I was able to create the super user.
Try this:
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
Upvotes: 2
Reputation: 31
$ run python manage.py syncdb
The system would try to sync and would ask:
You have installed Django's auth system, and don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'yogesh'):
Email address: [email protected]
Password:
Password (again):
Superuser created successfully.
I was facing the same problem and this stuff worked in my case.
Upvotes: -2
Reputation: 53649
Use the --username
flag instead of directly passing a username:
python manage.py createsuperuser --username thisismyusername
Upvotes: 4