在Django

时间:2015-12-16 06:41:03

标签: python django postgresql psycopg2

我已经有一个使用PostgreSQL作为db的应用程序。我想用Django构建一个服务。试过“inspectdb”......但它正在给予一个期待:

Traceback (most recent call last):
 File "manage.py", line 10, in <module>
   execute_from_command_line(sys.argv)
 File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
   utility.execute()
 File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 342, in execute
   self.fetch_command(subcommand).run_from_argv(self.argv)
 File "/usr/local/lib/python3.4/dist-packages/django/core/management/base.py", line 348, in run_from_argv
   self.execute(*args, **cmd_options)
 File "/usr/local/lib/python3.4/dist-packages/django/core/management/base.py", line 399, in execute
   output = self.handle(*args, **options)
 File "/usr/local/lib/python3.4/dist-packages/django/core/management/commands/inspectdb.py", line 25, in handle
   for line in self.handle_inspection(options):
 File "/usr/local/lib/python3.4/dist-packages/django/core/management/commands/inspectdb.py", line 70, in handle_inspection
   constraints = connection.introspection.get_constraints(cursor, table_name)
 File "/usr/local/lib/python3.4/dist-packages/django/db/backends/postgresql/introspection.py", line 172, in get_constraints
   "foreign_key": tuple(used_cols[0].split(".", 1)) if kind.lower() == "foreign key" else None,
IndexError: list index out of range

1 个答案:

答案 0 :(得分:3)

找出问题。

显然,db用户没有足够的权限。