我无法在Ckan上初始化数据库。我尝试在ubuntu 16.04和postgres 9.6上安装Ckan 2.8,然后按照官方page上的说明进行操作。
一切都很好,但是当我尝试初始化数据库时,我做不到。
这是错误。
Traceback (most recent call last):
File "/usr/lib/ckan/default/bin/paster", line 11, in <module>
sys.exit(run())
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 102, in run
invoke(command, command_name, options, args[1:])
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 141, in invoke
exit_code = runner.run(args)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 236, in run
result = self.command()
File "/usr/lib/ckan/default/src/ckan/ckan/lib/cli.py", line 363, in command
model.repo.init_db()
File "/usr/lib/ckan/default/src/ckan/ckan/model/__init__.py", line 188, in init_db
self.upgrade_db()
File "/usr/lib/ckan/default/src/ckan/ckan/model/__init__.py", line 266, in upgrade_db
mig.upgrade(self.metadata.bind, self.migrate_repository, version=version)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/migrate/versioning/api.py", line 186, in upgrade
return _migrate(url, repository, version, upgrade=True, err=err, **opts)
File "<decorator-gen-16>", line 2, in _migrate
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/migrate/versioning/util/__init__.py", line 160, in with_engine
return f(*a, **kw)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/migrate/versioning/api.py", line 366, in _migrate
schema.runchange(ver, change, changeset.step)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/migrate/versioning/schema.py", line 93, in runchange
change.run(self.engine, step)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/migrate/versioning/script/py.py", line 148, in run
script_func(engine)
File "/usr/lib/ckan/default/src/ckan/ckan/migration/versions/016_uuids_everywhere.py", line 69, in upgrade
drop_sequencies(migrate_engine)
File "/usr/lib/ckan/default/src/ckan/ckan/migration/versions/016_uuids_everywhere.py", line 186, in drop_sequencies
migrate_engine.execute('drop sequence %s_id_seq;' % sequence)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2064, in execute
return connection.execute(statement, *multiparams, **params)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 939, in execute
return self._execute_text(object, multiparams, params)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1097, in _execute_text
statement, parameters
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
context)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
exc_info
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
context)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) no existe la secuencia «package_extra_revision_id_seq»
[SQL: 'drop sequence package_extra_revision_id_seq;']
我尝试运行:
我在脚本运行时检查了数据库,并且脚本正确地创建了序列“ package_extra_revision_id_seq”。但是,当脚本完成后,序列“ package_extra_revision_id_seq”不再存在。
答案 0 :(得分:1)
“从源代码安装CKAN 2.8” Paster db init损坏并且没有报告,因此无论如何它将无法工作。解决方案是改为安装CKAN 2.7,因为依赖关系不同且可以正常工作。
安装后,用于初始化数据库的粘贴程序命令就会起作用