Nie so etwas gesehen. Als ich python manage.py syncdb
in einem Django-App auf dem Ubuntu-Terminal zu tun, ich sehe:`Fehler: Entpacken erfordert ein String-Argument der Länge 4` Fehler bei der Verwendung von Syncdb zu migrieren
error: unpack requires a string argument of length 4
Ich bin nicht sicher, was das bedeutet oder wie man es beheben.
> Traceback (most recent call last):
> File "/home/ubuntu/.virtualenvs/myenv/local/lib/python2.7/site-packages/django/core/management/base.py",
> line 222, in run_from_argv
> self.execute(*args, **options.__dict__)
> File "/home/ubuntu/.virtualenvs/myenv/local/lib/python2.7/site-packages/django/core/management/base.py",
> line 250, in execute
> translation.activate('en-us')
> File "/home/ubuntu/.virtualenvs/myenv/local/lib/python2.7/site-packages/django/utils/translation/__init__.py",
> line 90, in activate
> return _trans.activate(language)
> File "/home/ubuntu/.virtualenvs/myenv/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py",
> line 183, in activate
> _active.value = translation(language)
> File "/home/ubuntu/.virtualenvs/myenv/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py",
> line 172, in translation
> default_translation = _fetch(settings.LANGUAGE_CODE)
> File "/home/ubuntu/.virtualenvs/myenv/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py",
> line 133, in _fetch
> res = _translation(globalpath)
> File "/home/ubuntu/.virtualenvs/myenv/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py",
> line 127, in _translation
> t = gettext_module.translation('django', path, [loc], DjangoTranslation)
> File "/usr/lib/python2.7/gettext.py", line 493, in translation
> t = _translations.setdefault(key, class_(fp))
> File "/home/ubuntu/.virtualenvs/myenv/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py",
> line 75, in __init__
> gettext_module.GNUTranslations.__init__(self, *args, **kw)
> File "/usr/lib/python2.7/gettext.py", line 180, in __init__
> self._parse(fp)
> File "/usr/lib/python2.7/gettext.py", line 273, in _parse
> magic = unpack('<I', buf[:4])[0]
> error: unpack requires a string argument of length 4
Und manage.py
nur enthält:
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myapp.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
Bitte teilen Sie uns die Version von Django, die Sie verwenden, und buchen Sie die Traceback für die Ausnahme. (Wenn Sie kein Traceback sehen, fügen Sie dem Befehl syncdb den Befehl '--traceback 'hinzu.) – AKX