无效的应用名称 Django-CMS
Invalid app name Django-CMS
在 Raspbian 上使用 Django-CMS 3.0 安装文档,内核为 3.18.7,python3,pip3。当我运行
djangocms -p . mysite
我得到:
~/django/env$ sudo djangocms -p . mysite
Traceback (most recent call last):
File "/usr/local/bin/djangocms", line 9, in <module>
load_entry_point('djangocms-installer==0.7.2', 'console_scripts', 'djangocms')()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 337, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2280, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1990, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/local/lib/python3.2/dist-packages/djangocms_installer/main.py", line 8, in <module>
from . import config, django, install
File "/usr/local/lib/python3.2/dist-packages/djangocms_installer/config/__init__.py", line 101
sys.stderr.write(u"Project name '%s' is not a valid app name, "
SyntaxError: invalid syntax
注:我运行从~/django/env
.
Python3 不喜欢 DjangoCMS 3 使用的 unicode 助手:
# First of all, check if the project name is valid
if not validate_project(args.project_name):
sys.stderr.write(u"Project name '%s' is not a valid app name, "
u"or it's already defined. "
u"Please use only numbers, letters and underscores.\n"
% args.project_name)
sys.exit(3)
字符串之前的那些 'u' 给出了 python 3 的语法错误。您可以直接在该文件中修复它,检查 Django CMS 并请求修复,或者使用较低的 python的版本类似于2.7
这很奇怪,因为这里显示 python3 https://www.djangopackages.com/python3/
支持 DjangoCMS
我刚刚用 python3.2 解释器做了一些测试:
>>> sys.stderr.write(u"Hello ")
File "<stdin>", line 1
sys.stderr.write(u"Hello ")
^
SyntaxError: invalid syntax
>>> sys.stderr.write("Hello ")
6
Hello >>>
您应该将 Python 版本更新到 3.3 或 3.4。 django CMS 和 djangocms-installer 都不支持 Python 3.2.
正如@lapinkoira 所建议的,您看到的具体问题是由于 u''
-前缀。不过,这些已通过 Python 3.3 恢复,以便更轻松地支持 Python 2.6+ 和 Python 3.3+(另请参阅 PEP 414)
在 Raspbian 上使用 Django-CMS 3.0 安装文档,内核为 3.18.7,python3,pip3。当我运行
djangocms -p . mysite
我得到:
~/django/env$ sudo djangocms -p . mysite
Traceback (most recent call last):
File "/usr/local/bin/djangocms", line 9, in <module>
load_entry_point('djangocms-installer==0.7.2', 'console_scripts', 'djangocms')()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 337, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2280, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1990, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/local/lib/python3.2/dist-packages/djangocms_installer/main.py", line 8, in <module>
from . import config, django, install
File "/usr/local/lib/python3.2/dist-packages/djangocms_installer/config/__init__.py", line 101
sys.stderr.write(u"Project name '%s' is not a valid app name, "
SyntaxError: invalid syntax
注:我运行从~/django/env
.
Python3 不喜欢 DjangoCMS 3 使用的 unicode 助手:
# First of all, check if the project name is valid
if not validate_project(args.project_name):
sys.stderr.write(u"Project name '%s' is not a valid app name, "
u"or it's already defined. "
u"Please use only numbers, letters and underscores.\n"
% args.project_name)
sys.exit(3)
字符串之前的那些 'u' 给出了 python 3 的语法错误。您可以直接在该文件中修复它,检查 Django CMS 并请求修复,或者使用较低的 python的版本类似于2.7
这很奇怪,因为这里显示 python3 https://www.djangopackages.com/python3/
支持 DjangoCMS我刚刚用 python3.2 解释器做了一些测试:
>>> sys.stderr.write(u"Hello ")
File "<stdin>", line 1
sys.stderr.write(u"Hello ")
^
SyntaxError: invalid syntax
>>> sys.stderr.write("Hello ")
6
Hello >>>
您应该将 Python 版本更新到 3.3 或 3.4。 django CMS 和 djangocms-installer 都不支持 Python 3.2.
正如@lapinkoira 所建议的,您看到的具体问题是由于 u''
-前缀。不过,这些已通过 Python 3.3 恢复,以便更轻松地支持 Python 2.6+ 和 Python 3.3+(另请参阅 PEP 414)