python - django - trouble with migrations and modeltranslations -
i trying upgrade app, django v1.6.11 v1.7.8. following instructions upgrade south again , again same error. more precisely:
$ python manage.py migrate makemigrations /home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/reversion/admin.py:385: removedindjango18warning: commit_on_success deprecated in favor of atomic. def recover_view(self, request, version_id, extra_context=none): /home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/reversion/admin.py:397: removedindjango18warning: commit_on_success deprecated in favor of atomic. def revision_view(self, request, object_id, version_id, extra_context=none): /home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/django/forms/widgets.py:143: removedindjango18warning: `versionmetaadmin.queryset` method should renamed `get_queryset`. .__new__(mcs, name, bases, attrs)) /home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/cms/publisher/manager.py:5: removedindjango18warning: `publishermanager.get_query_set` method should renamed `get_queryset`. class publishermanager(models.manager): /home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/cms/models/managers.py:15: removedindjango18warning: `pagemanager.get_query_set` method should renamed `get_queryset`. class pagemanager(publishermanager): /home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/cms/admin/change_list.py:39: removedindjango18warning: `cmschangelist.get_query_set` method should renamed `get_queryset`. class cmschangelist(changelist): /home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/cms/admin/forms.py:397: removedindjango18warning: creating modelform without either 'fields' attribute or 'exclude' attribute deprecated - form pagepermissioninlineadminform needs updating class pagepermissioninlineadminform(forms.modelform): /home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/cms/admin/forms.py:499: removedindjango18warning: creating modelform without either 'fields' attribute or 'exclude' attribute deprecated - form viewrestrictioninlineadminform needs updating class viewrestrictioninlineadminform(pagepermissioninlineadminform): /home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/cms/admin/forms.py:548: removedindjango18warning: creating modelform without either 'fields' attribute or 'exclude' attribute deprecated - form pageuserform needs updating class pageuserform(usercreationform, genericcmspermissionform): /home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/django/forms/widgets.py:143: removedindjango18warning: `pagepermissioninlineadmin.queryset` method should renamed `get_queryset`. .__new__(mcs, name, bases, attrs)) /home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/django/forms/widgets.py:143: removedindjango18warning: `viewrestrictioninlineadmin.queryset` method should renamed `get_queryset`. .__new__(mcs, name, bases, attrs)) /home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/django/forms/widgets.py:143: removedindjango18warning: `pageuseradmin.queryset` method should renamed `get_queryset`. .__new__(mcs, name, bases, attrs)) /home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/django/template/base.py:290: removedindjango18warning: 'the `firstof` template tag changing escape arguments; non-autoescaping version deprecated. load `future` tag library start using new behavior. compiled_result = compile_func(self, token) traceback (most recent call last): file "manage.py", line 10, in <module> execute_from_command_line(sys.argv) file "/home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line utility.execute() file "/home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute django.setup() file "/home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/django/__init__.py", line 21, in setup apps.populate(settings.installed_apps) file "/home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/django/apps/registry.py", line 115, in populate app_config.ready() file "/home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/django/contrib/admin/apps.py", line 22, in ready self.module.autodiscover() file "/home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/django/contrib/admin/__init__.py", line 23, in autodiscover autodiscover_modules('admin', register_to=site) file "/home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/django/utils/module_loading.py", line 74, in autodiscover_modules import_module('%s.%s' % (app_config.name, module_to_search)) file "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) file "/home/roberto/workspace/unicms/unicms/unicms/admin.py", line 24, in <module> admin.site.register(researcharea, researchareaadmin) file "/home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 104, in register self._registry[model] = admin_class(model, self) file "/home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/modeltranslation/admin.py", line 239, in __init__ super(translationadmin, self).__init__(*args, **kwargs) file "/home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/modeltranslation/admin.py", line 28, in __init__ self.trans_opts = translator.get_options_for_model(self.model) file "/home/roberto/virtualenvs/ve_unicms-django1.7/local/lib/python2.7/site-packages/modeltranslation/translator.py", line 519, in get_options_for_model 'translation' % model.__name__) modeltranslation.translator.notregistered: model "researcharea" not registered translation
this seems me django-modeltranslation issue. have checked dependencies @ website , i'm using correct setup: django 1.7.11, python 2.7.5, django-modeltranslation 0.8.
$ pip freeze beautifulsoup==3.2.1 django==1.7.8 django-select2==4.3.1 fabric==1.10.1 pillow==2.8.1 south==1.0.2 argparse==1.2.1 cmsplugin-news==0.4.4 django-analytical==0.21.0 django-ckeditor==4.4.7 django-classy-tags==0.6.1 django-cms==3.0.13 django-cookie-law==1.0.2 django-country-dialcode==0.6.1 django-debug-toolbar==1.3.0 django-extensions==1.5.3 django-fabric==2.0.2 django-ga-tracking==0.0.6 django-guardian==1.2.5 django-haystack==2.3.1 django-modeltranslation==0.8 django-mptt==0.6.1 django-redis-cache==0.13.1 django-reusableapps==0.1.1 django-reversion==1.7.1 django-sekizai==0.8.1 django-tinymce==1.5.3 django-treebeard==3.0 djangocms-admin-style==0.2.5 djangocms-file==0.1 djangocms-link==1.6.1 djangocms-picture==0.1 djangocms-text-ckeditor==2.4.3 djangocms-video==0.1 easy-thumbnails==2.2 ecdsa==0.13 elasticsearch==1.4.0 feedparser==5.2.0 hiredis==0.2.0 html5lib==0.99999 paramiko==1.15.2 psycopg2==2.6 pycrypto==2.6.1 pyelasticsearch==1.2.3 python-ldap==2.4.19 pytz==2015.2 redis==2.10.3 requests==2.7.0 simplejson==3.6.5 six==1.9.0 sqlparse==0.1.15 switch2bill-common==2.8.5 urllib3==1.10.4 wsgiref==0.1.2 xmltodict==0.9.2
note: if uninstall south virtualenv, i'm still getting same error.
i have tried solve project deprecation warnings have been able find. anyhow, migration error still there. can see possible solution? :-)
settings.py:
import os import sys json import loads prod_f = open('/etc/django-settings.json', 'r') prod_data = prod_f.read() prod_f.close() json_data = filter(lambda x: x['id'] == 'mycms', loads(prod_data))[0] secret_key = json_data['secretkey'] databases = { 'default': { 'engine': json_data['database']['engine'], 'name': json_data['database']['name'], 'user': json_data['database']['user'], 'password': json_data['database']['pass'], 'host': json_data['database']['host'], 'port': json_data['database']['port'], }, 'backup': { 'engine': json_data['database']['engine'], 'name': 'tmpcms', 'user': json_data['database']['user'], 'password': json_data['database']['pass'], 'host': json_data['database']['host'], 'port': json_data['database']['port'], } } if 'test' in sys.argv or 'test_coverage' in sys.argv: # covers regular testing , django-coverage databases['default']['engine'] = 'django.db.backends.sqlite3' databases['backup']['engine'] = 'django.db.backends.sqlite3' # ### debug , error reporting ### debug = json_data['debug'] admins = json_data['admins'] send_broken_link_emails = json_data['debug_404'] server_email = 'no-reply@example.com' # ### end of debug , error reporting ### allowed_hosts = json_data['allowed_hosts'] internal_ips = json_data['internal_ips'] # django-modeltranslation fallback modeltranslation_fallback_languages = ('en', 'nb') gettext = lambda s: s project_path = os.path.abspath(os.path.dirname(__file__)) django.utils.translation import ugettext_lazy _ template_debug = debug managers = admins # local time zone installation. choices can found here: # http://en.wikipedia.org/wiki/list_of_tz_zones_by_name # although not choices may available on operating systems. # in windows environment must set system time zone. time_zone = 'europe/oslo' # language code installation. choices can found here: # http://www.i18nguy.com/unicode/language-identifiers.html language_code = 'en' site_id = 1 use_i18n = true use_l10n = true use_tz = true media_root = os.path.join(project_path, "media") media_url = "/media/" static_root = os.path.join(project_path, "static") static_url = '/static/' # url users should redirected login. # https://docs.djangoproject.com/en/dev/ref/settings/#login-url # #9820: missing link login_url = '/admin/' # additional locations of static files staticfiles_dirs = ( # put absolute paths here, "/home/html/static" or "c:/www/django/static". ) # list of finder classes know how find static files in # various locations. staticfiles_finders = ( 'django.contrib.staticfiles.finders.filesystemfinder', 'django.contrib.staticfiles.finders.appdirectoriesfinder', # 'django.contrib.staticfiles.finders.defaultstoragefinder', ) # list of callables know how import templates various sources. template_loaders = ( 'django.template.loaders.filesystem.loader', 'django.template.loaders.app_directories.loader', # 'django.template.loaders.eggs.loader', ) middleware_classes = ( 'django.middleware.cache.updatecachemiddleware', # caching 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.messages.middleware.messagemiddleware', 'django.middleware.locale.localemiddleware', 'django.middleware.common.commonmiddleware', 'django.middleware.doc.xviewmiddleware', 'django.middleware.clickjacking.xframeoptionsmiddleware', 'cms.middleware.page.currentpagemiddleware', 'cms.middleware.user.currentusermiddleware', 'cms.middleware.toolbar.toolbarmiddleware', 'cms.middleware.language.languagecookiemiddleware', 'django.middleware.cache.fetchfromcachemiddleware', # caching ) template_context_processors = ( 'django.contrib.auth.context_processors.auth', 'django.core.context_processors.i18n', 'django.core.context_processors.request', 'django.core.context_processors.media', 'django.core.context_processors.static', 'cms.context_processors.cms_settings', 'sekizai.context_processors.sekizai', 'ga_tracking.context_processors.ga_tracking_id', ) cms import __version__ cms_version djangocms_text_ckeditor import __version__ cms_cked_v int_cms_v = map(int, cms_version.split('.')[:1]) int_cms_cked_v = map(int, cms_cked_v.split('.')[:1]) if int_cms_v[0] == 3: if int_cms_cked_v[0] == 1: raise runtimeerror('it seems running django-cms v3.x. please upgrade djangocms_text_ckeditor>=v2') elif int_cms_cked_v[0] > 1: raise runtimeerror('it seems running django-cms v3.x , djangocms_text_ckeditor>=v2. please downgrade djangocms_text_ckeditor v1.x.') root_urlconf = 'mycms.urls' # python dotted path wsgi application used django's runserver. wsgi_application = 'mycms.wsgi.application' template_dirs = ( # put absolute paths here, "/home/html/django_templates" or "c:/www/django/templates". os.path.join(project_path, "templates"), ) import re ignorable_404_urls = ( re.compile(r'^/cms_search/'), re.compile(r'/favicon.ico'), re.compile(r'/'), ) cms_templates = ( # bunch of templates ) cms_permission = true languages = [ ('nb', _('norwegian')), ('en', _('english')), ] cms_languages = { 1: [ { 'code': 'en', 'name': 'english', 'fallbacks': ['nb'], 'public': true, }, { 'code': 'nb', 'name': 'norsk', 'public': true, } ], 'default': { 'fallbacks': ['en', 'nb'], 'redirect_on_fallback': true, 'public': false, 'hide_untranslated': false, } } migration_modules = { 'cms': 'cms.migrations_django', 'menus': 'menus.migrations_django', } # south migration unit tests integration: deactivate # http://south.readthedocs.org/en/latest/unittests.html south_tests_migrate = false # ###### django-guardian config ####### authentication_backends = ( 'django.contrib.auth.backends.modelbackend', # default 'guardian.backends.objectpermissionbackend', # django-guardian object-specific backend ) anonymous_user_id = '-1' # ### end of django-guardian config ### archive_page_size = 15 disable_latest_news_plugin = true # ###### ldap config ####### ldap_server = 'ldap://ldapproxy1.uib.no' ldap_username = ldap_password = '' ldap_base_dn = 'dc=uib,dc=no' # ### end of ldap config ### # ####### haystack config ####### import os haystack_connections = { 'default': { 'engine': 'haystack.backends.elasticsearch_backend.elasticsearchsearchengine', 'url': 'http://127.0.0.1:9200/', 'index_name': 'haystack', } } haystack_signal_processor = 'haystack.signals.realtimesignalprocessor' haystack_custom_highlighter = 'utils.haystack_utils.strongunihighlighter' # #### end of haystack config ### # ###### easy-thumbnails config ####### thumbnail_aliases = { '': { 'avatar_list': {'size': (45, 80), 'crop': 'scale'}, 'avatar_department_list': {'size': (45, 75), 'crop': 'scale'}, 'avatar_detail': {'size': (185, 201), 'crop': 'scale'}, 'avatar_plugin': {'size': (48, 76), 'crop': 'scale'}, 'news_small': {'size': (300, 200), 'crop': 'scale'}, 'news_medium': {'size': (364, 200), 'crop': 'scale'}, 'news_front_medium': {'size': (252, 150), 'crop': 'smart'}, 'news_big': {'size': (535, 354), 'crop': 'scale'}, 'share_linkedin': {'size': (180, 110), 'crop': 'smart'}, 'share_facebook': {'size': (600, 315), 'crop': 'smart'}, 'share_twitter': {'size': (120, 120), 'crop': 'smart'}, } } south_migration_modules = { 'easy_thumbnails': 'easy_thumbnails.south_migrations', } # default quality level jpg images on scale 1 (worst) 95 (best). # technically, values 100 allowed, not recommended. # http://easy-thumbnails.readthedocs.org/en/latest/ref/settings/#easy_thumbnails.conf.settings.thumbnail_quality thumbnail_quality = 85 # ### end of easy-thumbnails config ### # ### piwik stuff, monitoring ### piwik_site_id = 1 piwik_url = 'http://analytics.bccs.uib.no/' google_analytics_property_id = json_data['analytics_id'] # ####### end of piwik stuff ######## # ###### google analytics ####### ga_tracking_id = json_data['analytics_id'] ga_domain = 'uni.no' # ### end of google analytics ### installed_apps = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', # uncomment next line enable admin: 'django.contrib.admin', # uncomment next line enable admin documentation: # 'django.contrib.admindocs', 'django.contrib.sitemaps', 'modeltranslation', # django-cms 'djangocms_text_ckeditor', 'cms', 'mptt', 'menus', 'sekizai', # django-cms optional plugins 'djangocms_file', 'djangocms_link', 'djangocms_picture', 'easy_thumbnails', # requirement djangocms_picture #'djangocms_text', deactivated because of django-text-ckeditor 'djangocms_video', # django-cms versioning 'reversion', 'django_extensions', 'guardian', 'country_dialcode', 'ckeditor', 'ga_tracking', 'analytical', 'cookielaw', # django-haystack. must before custom apps 'haystack', # custom developed modules 'mycms', 'staff', 'project', 'department', 'group', 'research_area', 'topics', 'news', 'newsarchive', 'cms_search', 'manual_uploads', ) if 'test' in sys.argv or 'test_coverage' in sys.argv: installed_apps += filter(lambda app: app != 'djangocms_text_ckeditor', installed_apps) if debug: installed_apps += ('debug_toolbar',) debug_toolbar_patch_settings = false middleware_classes = ( 'django.middleware.cache.updatecachemiddleware', # caching 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.messages.middleware.messagemiddleware', 'django.middleware.locale.localemiddleware', 'django.middleware.common.commonmiddleware', 'django.middleware.doc.xviewmiddleware', 'django.middleware.clickjacking.xframeoptionsmiddleware', 'cms.middleware.page.currentpagemiddleware', 'cms.middleware.user.currentusermiddleware', 'cms.middleware.toolbar.toolbarmiddleware', 'cms.middleware.language.languagecookiemiddleware', 'debug_toolbar.middleware.debugtoolbarmiddleware', 'django.middleware.cache.fetchfromcachemiddleware', # caching ) locale_paths = ( os.path.join(project_path, 'locale'), ) # django-ckeditor: ckeditor_restrict_by_user = true ckeditor_upload_path = 'ck_uploads/' ckeditor_configs = { 'default': { 'width': '100%', 'toolbar': 'full', 'extraplugins': 'image2,templates,dialogui,dialog,clipboard,lineutils,widget,oembed', 'removeplugins': 'iframe,stylescombo,font,colorbutton,colordialog,forms,save,newpage,flash', 'language_list': ['nb:bokmål', 'en:english'], 'templates_replacecontent': false, }, 'newsletter': { 'width': '100%', 'toolbar': [ ['format', 'fontsize', "bold", "italic", "underline", "strike", "spellchecker"], ['textcolor', 'bgcolor'], [ 'numberedlist', 'bulletedlist', "indent", "outdent", 'justifyleft', 'justifycenter', 'justifyright', 'justifyblock' ], ['undo', 'redo'], ["source"], ], }, 'basic': { 'width': '100%', 'toolbar': 'basic', } } ckeditor_image_backend = 'pillow' # djangocms-text-ckeditor: ckeditor_settings = { 'language': 'en', 'toolbar': 'full', 'skin': 'moono' } # django-redis-cache caches = { 'default': { 'backend': 'redis_cache.rediscache', 'location': 'localhost:6379', 'options': { 'db': 1, # 'password': 'yadayada', 'parser_class': 'redis.connection.hiredisparser' }, }, } # end django-redis-cache # django caching cache_middleware_alias = 'default' cache_middleware_seconds = 300 cache_middleware_key_prefix = '' # end django caching logging = { 'version': 1, 'disable_existing_loggers': false, 'formatters': { 'verbose': { 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' }, 'simple': { 'format': '%(levelname)s %(message)s' }, }, 'filters': { 'require_debug_false': { '()': 'django.utils.log.requiredebugfalse' } }, 'handlers': { 'mail_admins': { 'level': 'error', 'filters': ['require_debug_false'], 'class': 'django.utils.log.adminemailhandler' }, 'console': { 'level': 'error', 'class': 'logging.streamhandler', 'formatter': 'verbose' }, }, 'loggers': { 'django': { 'handlers': ['console'], 'level': 'error', 'propagate': true, }, 'django.request': { 'handlers': ['mail_admins'], 'level': 'error', 'propagate': true, }, 'department.models': { 'handlers': ['console'], 'level': 'error' }, 'django.db.backends': { 'level': 'error', 'handlers': ['console'], }, } } login_url = '/login/' test_runner = 'django.test.runner.discoverrunner'
update: after dukeofweatherby's suggestion i've removed call admin.autodiscover() urls.py. anyhow, after i'm still getting same error.
update 2: from translation import *
before importing translationadmin solved issue
encountering problem, able resolve removing
admin.autodiscover()
django 1.7 automatically discovers admin files in new app loading functionality , guess having messes loading order.
Comments
Post a Comment