alias51 alias51 - 3 years ago 229
Python Question

Error creating superuser in Django

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:

> ./ createsuperuser

However, I get the following error:

Traceback (most recent call last):
File "./", line 10, in <module>
File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/django/core/management/", line 399, i
n execute_from_command_line
File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/django/core/management/", line 392, i
n execute
File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/django/core/management/", line 242, in ru
self.execute(*args, **options.__dict__)
File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/django/core/management/", line 285, in ex
output = self.handle(*args, **options)
File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsu", line 141, in handle
File "/vagrant/myapp/accounts/", line 52, in create_superuser
return self._create_user(email, password, True, True, **extra_fields)
File "/vagrant/myapp/accounts/", line 31, in _create_user
File "/vagrant/myapp/accounts/", 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/", line 101, in slugify
text = join_words(words, separator, max_length)
File "/home/vagrant/Envs/myapp/local/lib/python2.7/site-packages/slugify/", line 78, in join_words
text = next(words) # text = words.pop(0)

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...?

Answer Source

Use the --username flag instead of directly passing a username:

python createsuperuser --username thisismyusername
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download