Running backup.sh on Django 1.7 throws an error
Project for backing up network device configuration
Brought to you by:
honyczek
Traceback (most recent call last): File "./backup_all_devices.py", line 6, in <module> from frontend.models import Device File "/srv/www/confiback/frontend/models.py", line 15, in <module> class Profile(models.Model): File "/srv/www/confiback/frontend/models.py", line 23, in Profile name = models.CharField(max_length=50, verbose_name=_("Name")) File "/usr/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 83, in ugettext return _trans.ugettext(message) File "/usr/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 325, in ugettext return do_translate(message, 'ugettext') File "/usr/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 306, in do_translate _default = translation(settings.LANGUAGE_CODE) File "/usr/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 209, in translation default_translation = _fetch(settings.LANGUAGE_CODE) File "/usr/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 189, in _fetch "The translation infrastructure cannot be initialized before the " django.core.exceptions.AppRegistryNotReady: The translation infrastructure cannot be initialized before the apps registry is ready. Check that you don't make non-lazy gettext calls at import time.
When I updated to Django 1.7, there was an error appearing when backup.sh was executed. To fix it you must add two lines into '''backup_all_devices.py'''. See attached diff file.