从django 1..x和cms插件迁移到django cms插件和django 2后出错
在升级我的应用程序的requirements.txt文件中的旧软件包时,我得到了以下错误,其中不推荐的cms插件升级到了较新的djangocms插件:从django 1..x和cms插件迁移到django cms插件和django 2后出错,django,python-3.5,Django,Python 3.5,在升级我的应用程序的requirements.txt文件中的旧软件包时,我得到了以下错误,其中不推荐的cms插件升级到了较新的djangocms插件: <code> (tonhausPZ) root@manelmr-Lenovo-G560:/home/manel-mr/PhilippZ# python manage.py migrate djangocms-picture python: can't open file 'manage.py': [Errno 2] No such
<code>
(tonhausPZ) root@manelmr-Lenovo-G560:/home/manel-mr/PhilippZ# python manage.py migrate djangocms-picture
python: can't open file 'manage.py': [Errno 2] No such file or directory
(tonhausPZ) root@manelmr-Lenovo-G560:/home/manel-mr/PhilippZ# python src/manage.py migrate djangocms-picture
Traceback (most recent call last):
File "src/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/manel-mr/PhilippZ/src/tonhaus/tonhausPZ/lib/python3.5/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/manel-mr/PhilippZ/src/tonhaus/tonhausPZ/lib/python3.5/site-packages/django/core/management/__init__.py", line 357, in execute
django.setup()
File "/home/manel-mr/PhilippZ/src/tonhaus/tonhausPZ/lib/python3.5/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/manel-mr/PhilippZ/src/tonhaus/tonhausPZ/lib/python3.5/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/home/manel-mr/PhilippZ/src/tonhaus/tonhausPZ/lib/python3.5/site-packages/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/home/manel-mr/PhilippZ/src/tonhaus/tonhausPZ/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/manel-mr/PhilippZ/src/tonhaus/tonhausPZ/lib/python3.5/site-packages/djangocms_picture/models.py", line 15, in <module>
from cms.models import CMSPlugin
File "/home/manel-mr/PhilippZ/src/tonhaus/tonhausPZ/lib/python3.5/site-packages/cms/models/__init__.py", line 3, in <module>
from .pagemodel import * # nopyflakes
File "/home/manel-mr/PhilippZ/src/tonhaus/tonhausPZ/lib/python3.5/site-packages/cms/models/pagemodel.py", line 24, in <module>
from cms.models.managers import PageManager, PageNodeManager
File "/home/manel-mr/PhilippZ/src/tonhaus/tonhausPZ/lib/python3.5/site-packages/cms/models/managers.py", line 15, in <module>
from cms.utils.i18n import get_fallback_languages
File "/home/manel-mr/PhilippZ/src/tonhaus/tonhausPZ/lib/python3.5/site-packages/cms/utils/__init__.py", line 7, in <module>
from cms.utils.conf import get_site_id # nopyflakes
File "/home/manel-mr/PhilippZ/src/tonhaus/tonhausPZ/lib/python3.5/site-packages/cms/utils/conf.py", line 11, in <module>
from cms import __version__
ImportError: cannot import name '__version__'
(tonhausPZ) root@manelmr-Lenovo-G560:/home/manel-mr/PhilippZ#
</code>
文件settings.py包含以下代码:
<code>
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
)
SITE_ID = 1
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'OPTIONS': {
'context_processors': (
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.i18n',
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.template.context_processors.media',
'django.template.context_processors.csrf',
'django.template.context_processors.tz',
'sekizai.context_processors.sekizai',
'django.template.context_processors.static',
'cms.context_processors.cms_settings',
'cms_tonhaus.context_processors.product_ordering',
'cms_tonhaus.context_processors.wishlist_count',
),
'loaders': (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader'
)
}
},
]
MIDDLEWARE = (
'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.clickjacking.XFrameOptionsMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware'
)
INSTALLED_APPS = (
'djangocms_admin_style',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.sites',
'django.contrib.sitemaps',
'django.contrib.staticfiles',
'django.contrib.messages',
'djangocms_picture',
'djangocms_text_ckeditor',
'filer',
'cms',
'django_select2',
'djangocms_file',
'djangocms_audio',
'djangocms_video',
'djangocms_googlemap',
'compressor',
'django_social_share',
'easy_thumbnails',
'djangocms_style',
'djangocms_snippet',
'menus',
'sekizai',
'treebeard',
'djangocms_link',
'djangocms_rosetta',
'rosetta',
'cms_tonhaus',
'tonhaus'
)
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
LANGUAGES = (
## Customize this
('de', gettext('de')),
('it', gettext('it')),
)
LOCALE_PATHS = (os.path.join(BASE_DIR, 'locale'),)
</code>
数据库表包括:
<code>
mysql> use www_tonhaus
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+-------------------------------------+
| Tables_in_www_tonhaus |
+-------------------------------------+
| auth_group |
| auth_group_permissions |
| auth_permission |
| auth_user |
| auth_user_groups |
| auth_user_user_permissions |
| cms_aliaspluginmodel |
| cms_cmsplugin |
| cms_globalpagepermission |
| cms_globalpagepermission_sites |
| cms_page |
| cms_page_placeholders |
| cms_pagepermission |
| cms_pageuser |
| cms_pageusergroup |
| cms_placeholder |
| cms_placeholderreference |
| cms_staticplaceholder |
| cms_title |
| cms_tonhaus_artistmodel |
| cms_tonhaus_categorymodel |
| cms_tonhaus_productmodel |
| cms_tonhaus_simplefilerimagemodel |
| cms_tonhaus_wishlistmodel |
| cms_tonhaus_wishlistmodel_products |
| cms_treenode |
| cms_urlconfrevision |
| cms_usersettings |
| cmsplugin_filer_image_filerimage |
| django_admin_log |
| django_content_type |
| django_migrations |
| django_session |
| django_site |
| djangocms_audio_audiofile |
| djangocms_audio_audiofolder |
| djangocms_audio_audioplayer |
| djangocms_audio_audiotrack |
| djangocms_file_file |
| djangocms_file_folder |
| djangocms_googlemap_googlemap |
| djangocms_googlemap_googlemapmarker |
| djangocms_googlemap_googlemaproute |
| djangocms_link_link |
| djangocms_picture_picture |
| djangocms_snippet_snippet |
| djangocms_snippet_snippetptr |
| djangocms_style_style |
| djangocms_text_ckeditor_text |
| djangocms_video_videoplayer |
| djangocms_video_videosource |
| djangocms_video_videotrack |
| easy_thumbnails_source |
| easy_thumbnails_thumbnail |
| easy_thumbnails_thumbnaildimensions |
| filer_clipboard |
| filer_clipboarditem |
| filer_file |
| filer_folder |
| filer_folderpermission |
| filer_image |
| filer_thumbnailoption |
| menus_cachekey |
| reversion_revision |
| reversion_version |
+-------------------------------------+
</code
mysql>使用www_tonhaus
读取表信息以完成表和列名
您可以关闭此功能,以便使用-a快速启动
数据库已更改
mysql>显示表格;
+-------------------------------------+
|汤豪斯的表格|
+-------------------------------------+
|认证组|
|授权组权限|
|授权许可|
|授权用户|
|验证用户组|
|验证用户权限|
|cms\U别名插件模型|
|cms_cmsplugin|
|cms_globalpagepermission|
|cms\u globalpagepermission\u网站|
|cms_页面|
|cms\u页面\u占位符|
|cms_页面权限|
|页面用户|
|cms_页面用户组|
|cms_占位符|
|cms_占位符参考|
|静态占位符|
|cms_标题|
|cms_tonhaus_artistmodel|
|cms_tonhaus_分类模型|
|cms\u tonhaus\u产品模型|
|cms_tonhaus_SimpleFileImageModel|
|cms_tonhaus_Wishlist模型|
|cms\u tonhaus\u wishlistmodel\u产品|
|cms_treenode|
|修订版|
|cms_用户设置|
|cmsplugin\u文件服务器\u图像\u文件图像|
|django_管理日志|
|django_内容类型|
|django_迁移|
|django_会议|
|django_遗址|
|djangocms_音频_音频文件|
|djangocms_audio_audio文件夹|
|Djangoms_音频播放器|
|Djangoms_audio_audiotrack|
|djangocms_文件|
|djangocms_文件_文件夹|
|Djangoms_谷歌地图_谷歌地图|
|Djangoms_googlemap_googlemapmarker|
|Djangoms_谷歌地图_谷歌地图路线|
|djangocms_链接|
|Djangoms_图片_图片|
|djangocms_片段_片段|
|djangocms_代码段_代码段ptr|
|Djangoms_风格_风格|
|djangocms_text_ckeditor_text|
|Djangoms_视频播放器|
|djangocms_视频源|
|Djangoms_视频跟踪|
|简易\u缩略图\u源|
|简单的缩略图|
|简易\u缩略图\u缩略图尺寸|
|文件管理器剪贴板|
|文件管理器剪贴板项|
|文件管理器|
|文件管理器文件夹|
|文件管理器\u文件夹权限|
|文件服务器映像|
|filer\u缩略图选项|
|菜单\u缓存键|
|复归修订|
|复归版本|
+-------------------------------------+
想法:1。你能在你的venv中找到一个叫做cms的目录吗?只是想知道是否有一个名为\uuuuu version\uuuuu.py
的文件,因为您有一个导入错误。2.也许你打错电话了?(只需阅读第一部分。不要认为你应该做src/manage.py)用cd..
返回dir,然后用python manage.py migrate djangocms picture
再试一次。在名为tonhausPZ的venv中,tonhausPZ/lib/python3.5/site-packages/cms/文件夹中没有名为version.py的文件。我在文件夹tonhausPZ/lib/python3.5/site-packages/updateable、tonhausPZ/lib/python3.5/site-packages/requests、tonhausPZ/lib/python3.5/site-packages/pip//u vendor/requests中找到了两个不同的文件version.py。python manage.py migrate总是会出现相同的错误……我知道在以前的迁移中没有出现此错误。我不知道每当我键入命令时,我的代码会发生什么变化来生成此错误。让我们看看是否可以与您一起解决此问题。首先,我检查了一下,因为这是你问题的根源。您是否卸载了django cms包?如果没有,请转到cms/\uuuuu init\uuuuuuu.py。当你到达那里时,检查它是否与这个文件匹配:如果你没有安装Django cms,那就是你的问题。
<code>
mysql> use www_tonhaus
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+-------------------------------------+
| Tables_in_www_tonhaus |
+-------------------------------------+
| auth_group |
| auth_group_permissions |
| auth_permission |
| auth_user |
| auth_user_groups |
| auth_user_user_permissions |
| cms_aliaspluginmodel |
| cms_cmsplugin |
| cms_globalpagepermission |
| cms_globalpagepermission_sites |
| cms_page |
| cms_page_placeholders |
| cms_pagepermission |
| cms_pageuser |
| cms_pageusergroup |
| cms_placeholder |
| cms_placeholderreference |
| cms_staticplaceholder |
| cms_title |
| cms_tonhaus_artistmodel |
| cms_tonhaus_categorymodel |
| cms_tonhaus_productmodel |
| cms_tonhaus_simplefilerimagemodel |
| cms_tonhaus_wishlistmodel |
| cms_tonhaus_wishlistmodel_products |
| cms_treenode |
| cms_urlconfrevision |
| cms_usersettings |
| cmsplugin_filer_image_filerimage |
| django_admin_log |
| django_content_type |
| django_migrations |
| django_session |
| django_site |
| djangocms_audio_audiofile |
| djangocms_audio_audiofolder |
| djangocms_audio_audioplayer |
| djangocms_audio_audiotrack |
| djangocms_file_file |
| djangocms_file_folder |
| djangocms_googlemap_googlemap |
| djangocms_googlemap_googlemapmarker |
| djangocms_googlemap_googlemaproute |
| djangocms_link_link |
| djangocms_picture_picture |
| djangocms_snippet_snippet |
| djangocms_snippet_snippetptr |
| djangocms_style_style |
| djangocms_text_ckeditor_text |
| djangocms_video_videoplayer |
| djangocms_video_videosource |
| djangocms_video_videotrack |
| easy_thumbnails_source |
| easy_thumbnails_thumbnail |
| easy_thumbnails_thumbnaildimensions |
| filer_clipboard |
| filer_clipboarditem |
| filer_file |
| filer_folder |
| filer_folderpermission |
| filer_image |
| filer_thumbnailoption |
| menus_cachekey |
| reversion_revision |
| reversion_version |
+-------------------------------------+
</code