项目创建期间使用&#d; djangocms'命令

时间:2016-10-04 21:55:08

标签: python django pip django-cms

  • Django CMS 3.4.1
  • Django 1.10.2
  • pip modules:http://pastebin.com/vJWvZVfA
  • pip 8.1.2
  • Python 2.7.12
  • 操作系统:Amazon Linux AMI版本2016.03

我是Django CMS,Django和Python的新手。我以前的CMS体验一直是使用WordPress,我尝试尝试使用Django CMS作为WordPress的替代品,但是我得到了一个我似乎无法弄清楚的错误。我已经更新了pip模块并按照StackOverflow上的线程中的建议安装了其他模块,但无济于事。

我遵循tutorial the instructions,但djangocms命令除外,这在教程中是不正确的。 (它缺少-w标志。)

编辑:根据要求,这里是添加了--verbose标志的输出:

(env)[ec2-user@(redacted) tutorial-project]$ djangocms -d postgres://(redacted) -e no --permissions yes -l "en-CA, en-US, en, fr-CA, fr-FR" -p . --starting-page yes --verbose --utc mysite
Creating the project
Please wait while I install dependencies
Package install command: install django-cms<3.5 djangocms-admin-style>=1.2,<1.3 django-treebeard>=4.0,<5.0 psycopg2 djangocms-text-ckeditor>=3.2.1 djangocms-link>=1.8 djangocms-style>=1.7 djangocms-googlemap>=0.5 djangocms-snippet>=1.9 djangocms-video>=2.0 djangocms-column>=1.6 easy_thumbnails django-filer>=1.2 cmsplugin-filer>=1.1 Django<1.9 pytz django-classy-tags>=0.7 html5lib>=0.999999,<0.99999999 Pillow>=3.0 django-sekizai>=0.9 django-select2<5.0six
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-duWZSN/psycopg2/
The installation has failed.


*****************************************************************

Check documentation at https://djangocms-installer.readthedocs.io

*****************************************************************

Traceback (most recent call last):
  File "/home/ec2-user/env/bin/djangocms", line 11, in <module>
    sys.exit(execute())
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/djangocms_installer/main.py", line 33, in execute
    verbose=config_data.verbose
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/djangocms_installer/install/__init__.py", line 91, in requirements
    output = subprocess.check_output(['pip'] + args)
  File "/usr/lib64/python2.7/subprocess.py", line 574, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '[u'pip', u'install', u'django-cms<3.5', u'djangocms-admin-style>=1.2,<1.3', u'django-treebeard>=4.0,<5.0', u'psycopg2', u'djangocms-text-ckeditor>=3.2.1', u'djangocms-link>=1.8', u'djangocms-style>=1.7', u'djangocms-googlemap>=0.5', u'djangocms-snippet>=1.9', u'djangocms-video>=2.0', u'djangocms-column>=1.6', u'easy_thumbnails', u'django-filer>=1.2', u'cmsplugin-filer>=1.1', u'Django<1.9', u'pytz', u'django-classy-tags>=0.7', u'html5lib>=0.999999,<0.99999999', u'Pillow>=3.0', u'django-sekizai>=0.9', u'django-select2<5.0six']' returned non-zero exit status 1

编辑2 :(转而回答)

编辑3:

解决第一部分后,仍然存在另一个错误。我将它包括在这篇文章中,因为它仍然属于标题的主题:

Creating the project
Project creation command: /home/ec2-user/env/bin/python2.7 /home/ec2-user/env/bin/django-admin.py startproject mysite /home/ec2-user/tutorial-project
Database setup commands: /home/ec2-user/env/bin/python2.7 -W ignore manage.py migrate
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 93, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 19, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 47, in __init__
    self.build_graph()
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 191, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 59, in applied_migrations
    self.ensure_schema()
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 49, in ensure_schema
    if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 162, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 135, in _cursor
    self.ensure_connection()
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 130, in ensure_connection
    self.connect()
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 118, in connect
    conn_params = self.get_connection_params()
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 158, in get_connection_params
    "settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the NAME value.
The installation has failed.


*****************************************************************

Check documentation at https://djangocms-installer.readthedocs.io

*****************************************************************

Traceback (most recent call last):
  File "/home/ec2-user/env/bin/djangocms", line 11, in <module>
    sys.exit(execute())
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/djangocms_installer/main.py", line 41, in execute
    django.setup_database(config_data)
  File "/home/ec2-user/env/local/lib/python2.7/site-packages/djangocms_installer/django/__init__.py", line 388, in setup_database
    output = subprocess.check_output(command, env=env)
  File "/usr/lib64/python2.7/subprocess.py", line 574, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['/home/ec2-user/env/bin/python2.7', u'-W', u'ignore', u'manage.py', u'migrate']' returned non-zero exit status 1

我猜测问题出在信息中:

settings.DATABASES is improperly configured. Please supply the NAME value. The installation has failed.

我使用的是PostgreSQL,因此我假设错误是由命令参数中未提供的架构引起的。我看到指南中没有任何内容表明如何提供它,所以我不得不再搜索一下。

2 个答案:

答案 0 :(得分:0)

错误消息绝对没有告诉我。它只告诉我Django试图使用pip安装一些东西,无论出于什么原因它失败了。为了弄清楚出了什么问题,请尝试启用详细模式(python -v)。如果它提供相同的输出,或者不是一个选项,因为你正在使用一个调用Python的程序(它听起来像你),请告诉我并准备进入源代码。相信我,我已经深入研究了Python实用程序的源代码,只要你不做任何愚蠢的事情(比如删除文件),就很难弄乱任何东西。即使你这样做,你也可以随时重新安装Django(或先备份)。不要担心弄乱你的电脑。你必须努力让Django做到这一点!

答案 1 :(得分:0)

原始错误

非详细错误消息以神秘的方式指示错误,并且使用--verbose提供更易理解的消息。

我缺少一个必需的模块(psycopg2),另外四个版本太新了(easy_thumbnails,Django,html5lib,django-select2)。

我卸载了四个模块,然后使用命令中的版本要求重新安装它们。例如pip install&#39; Django&lt; 1.10&#39;。

psycopg2需要额外的步骤,因为我在尝试安装它时收到错误消息,表明它无法找到pg_config。另一个SO答案建议我只需要安装postgresql-devel。在我这样做之后,(sudo yum install postgresql-devel),我也卸载了postgresql8-libs,因为postgresql-devel附带了更新的版本。我之前没有这样做,因为yum表示PHP依赖,如果我这样做,我不确定它是否会引起问题。

第二个错误

非常简单。我错过了数据库URL的/ NAME组件(postgres:// USER:PASSWORD @ HOST:PORT / NAME)。