使用postgresql配置django cms时出错

时间:2016-02-04 09:57:11

标签: python django postgresql content-management-system

我按照以下步骤操作:

sudo apt-get update
sudo apt-get install python-pip python-dev libpq-dev postgresql postgresql-contrib
sudo su - postgres
psql
CREATE DATABASE mydb;
CREATE USER admin WITH PASSWORD 'admin';
ALTER ROLE admin SET client_encoding TO 'utf8';
ALTER ROLE admin SET default_transaction_isolation TO 'read committed';
ALTER ROLE admin SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE mydb TO admin;
\q
exit
sudo pip install virtualenv
mkdir ~/myworkspace
cd ~/myworkspace
virtualenv myproject_env
source myproject_env/bin/activate
pip install djangocms-installer
mkdir myproject
cd myproject
djangocms -f -p . mysite
Database configuration (in URL format):postgresql://admin:admin@localhost:5432/mydb
django CMS version: stable
Django version: stable
Activate Django I18N / L10N setting: yes
Install and configure reversion support: yes
Languages to enable. Option can be provided multiple times, or as a comma separated list: en
Optional default time zone: Asia/Kolkata
Activate Django time zone support: yes
Activate CMS permission management: yes
Use Twitter Bootstrap Theme: yes 
Use custom template set: no
Load a starting page with examples after installation: yes

'之后它会给出一些错误------'

Creating the project
Please wait while I install dependencies
Dependencies installed
Creating the project
Traceback (most recent call last): File "manage.py", line 10, in <module>execute_from_command_line(sys.argv)
File "/home/sqc2/myworkspace/myproject_env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_lineutility.execute()
File "/home/sqc2/myworkspace/myproject_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/sqc2/myworkspace/myproject_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/sqc2/myworkspace/myproject_env/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute output = self.handle(*args, **options)
File "/home/sqc2/myworkspace/myproject_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/sqc2/myworkspace/myproject_env/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 19, in __init__self.loader = MigrationLoader(self.connection)
File "/home/sqc2/myworkspace/myproject_env/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 47, in __init__self.build_graph()
File "/home/sqc2/myworkspace/myproject_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/sqc2/myworkspace/myproject_env/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 59, in applied_migrations self.ensure_schema()
File "/home/sqc2/myworkspace/myproject_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/sqc2/myworkspace/myproject_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/sqc2/myworkspace/myproject_env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 135, in _cursor self.ensure_connection()
File "/home/sqc2/myworkspace/myproject_env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 130, in ensure_connection self.connect()
File "/home/sqc2/myworkspace/myproject_env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 114, in connect self.close_at = None if max_age is None else time.time() + max_age
TypeError: unsupported operand type(s) for +: 'float' and 'str' Failure occurred. Do you want to cleanup by removing /home/sqc2/myworkspace/myproject? [Y/N]

'Ubuntu版:15.10  python版本:2.7  django版本:1.10  django-cms版本:3.2  postgresql版本9.4'

'我无法理解这是什么问题。请帮帮我。'

1 个答案:

答案 0 :(得分:0)

最后我找到了解决方案。我认为这个问题与djangocms-installer的最新版本有关,因为我使用了另一个版本。我用下一个命令安装它并修复了问题:

pip install -e git+https://github.com/nephila/djangocms-installer#egg=djangocms-installer