我用DjangCMS(3.7.2(开发了一个简单的项目,它在本地运行得很好。我将在ubuntu服务器上运行它,我有另一个Django项目在上面运行,没有任何问题。我的两个项目都是使用python 3.6&MySQL数据库。我采取了以下步骤来运行我的新项目:
- 通过git从服务器克隆项目并更新
settings.py
文件 - 在服务器上创建了一个空数据库
python3 -m venv venv
在服务器上安装了虚拟机- 激活
venv
并升级pip
- 使用
pip install -r requirements.txt
成功安装需求 - 尝试通过
python3 manage.py migrate
进行迁移
但我得到了这个错误:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/var/www/pishbiny/myenv/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/var/www/pishbiny/myenv/lib/python3.6/site-packages/django/core/management/__init__.py", line 377, in execute
django.setup()
File "/var/www/pishbiny/myenv/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/var/www/pishbiny/myenv/lib/python3.6/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/var/www/pishbiny/myenv/lib/python3.6/site-packages/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/var/www/pishbiny/myenv/lib/python3.6/site-packages/cms/models/__init__.py", line 3, in <module>
from .pagemodel import * # nopyflakes
File "/var/www/pishbiny/myenv/lib/python3.6/site-packages/cms/models/pagemodel.py", line 31, in <module>
from menus.menu_pool import menu_pool
File "/var/www/pishbiny/myenv/lib/python3.6/site-packages/menus/menu_pool.py", line 18, in <module>
from menus.exceptions import NamespaceAlreadyRegistered
ImportError: cannot import name 'NamespaceAlreadyRegistered'
- 服务器上安装了以下依赖项:
asgiref 3.2.7
chardet 3.0.4
cms 0.0.2
dj-database-url 0.5.0
Django 3.0.5
django-classy-tags 1.0.0
django-cms 3.7.2
django-filer 1.7.0
django-formtools 2.2
django-js-asset 1.2.2
django-mptt 0.11.0
django-polymorphic 2.1.2
django-sekizai 1.1.0
django-treebeard 4.3.1
djangocms-admin-style 1.5.0
djangocms-attributes-field 1.2.0
djangocms-bootstrap4 1.6.0
djangocms-file 2.4.0
djangocms-googlemap 1.4.0
djangocms-icon 1.5.0
djangocms-installer 1.2.3
djangocms-link 2.6.0
djangocms-picture 2.4.0
djangocms-snippet 2.3.0
djangocms-style 2.3.0
djangocms-text-ckeditor 3.9.0
djangocms-video 2.3.0
dsdev-utils 1.0.4
easy-thumbnails 2.7
html5lib 1.0.1
Menus 0.2.0
mysqlclient 1.4.6
Pillow 7.1.2
pip 20.1
pkg-resources 0.0.0
pytz 2020.1
setuptools 39.0.1
six 1.14.0
sqlparse 0.3.1
tzlocal 2.0.0
Unidecode 1.1.1
webencodings 0.5.1
wheel 0.34.2
我删除了venv,并多次重新安装所有依赖项,但都不起作用。让我知道我犯了什么错。非常感谢您能提供的任何帮助。
如Alasdair所述:
我通过运行python3 -m pip install "django-cms==3.7.2"
重新安装了Django CMS模块,令人惊讶的是它竟然能工作。