Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
预构建的django项目在迁移时出错_Django_Postgresql_Manage.py_Django Manage.py - Fatal编程技术网

预构建的django项目在迁移时出错

预构建的django项目在迁移时出错,django,postgresql,manage.py,django-manage.py,Django,Postgresql,Manage.py,Django Manage.py,我有一个预先构建的django项目,需要在Ubuntu18上运行它。使用postgresql作为数据库引擎,完成并安装了所有必备组件。为project创建了一个db并添加了具有所需权限的用户,然后将这些设置更新到settings.py文件中 然后我运行以下命令来准备迁移并实现它 # python manage.py makemigrations No changes detected & 你们有谁知道怎么修理吗??django服务器正在运行,但是我得到了这个页面,我想这与数据库连接有关。 现在

我有一个预先构建的django项目,需要在Ubuntu18上运行它。使用postgresql作为数据库引擎,完成并安装了所有必备组件。为project创建了一个db并添加了具有所需权限的用户,然后将这些设置更新到settings.py文件中

然后我运行以下命令来准备迁移并实现它

# python manage.py makemigrations
No changes detected
&

你们有谁知道怎么修理吗??django服务器正在运行,但是我得到了这个页面,我想这与数据库连接有关。 现在显示的页面截图附在附件中

您可以做的是:使用postgres超级用户在数据库中创建postgis扩展

使用安装postgresql时提供的超级用户用户名登录到postgres shell:

sudo-i-upsql

连接到您的数据库:

\连接

将postgis扩展创建为:

创建扩展postgis

如果在创建扩展时遇到权限问题,可以了解用户权限

您可以做的是:使用postgres超级用户在数据库中创建postgis扩展

使用安装postgresql时提供的超级用户用户名登录到postgres shell:

sudo-i-upsql

连接到您的数据库:

\连接

将postgis扩展创建为:

创建扩展postgis


如果在创建扩展时遇到权限问题,可以了解用户权限

不,那个屏幕截图与连接无关。它告诉你问题出在哪里。@DanielRoseman那么作为系统管理员应该寻找什么呢?试着用的超级用户自己在数据库中添加postgis扩展postgres@Sanip我在创建超级用户时也会出错。你是说django超级用户还是postgres超级用户?不,那个屏幕截图与连接无关。它告诉你问题出在哪里。@DanielRoseman那么作为系统管理员应该寻找什么呢?试着用的超级用户自己在数据库中添加postgis扩展postgres@Sanip我在创建超级用户时也会出错。你是说django超级用户还是postgres超级用户?但我仍然没有找到相同的页面,管理面板也不加载。即使my db的表格以终端形式显示数据,您确定您的应用程序中有“/”的urlconf吗?谢谢您的步骤式解释。你们能帮我在网站中使用Shapefile地图吗?但我仍然找不到相同的页面,并且管理面板也不加载。即使my db的表格以终端形式显示数据,您确定您的应用程序中有“/”的urlconf吗?谢谢您的步骤式解释。你能帮我在网站上使用Shapefile地图吗。
# python manage.py migrate
Traceback (most recent call last):
  File "/home/hsn/env_banax_api/lib/python3.6/site-packages/django/db/backends/utils.py", line 83, in _execute
    return self.cursor.execute(sql)
psycopg2.ProgrammingError: permission denied to create extension "postgis"
HINT:  Must be superuser to create this extension.


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/home/hsn/env_banax_api/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/home/hsn/env_banax_api/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/hsn/env_banax_api/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/hsn/env_banax_api/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
    output = self.handle(*args, **options)
  File "/home/hsn/env_banax_api/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 77, in handle
    connection.prepare_database()
  File "/home/hsn/env_banax_api/lib/python3.6/site-packages/django/contrib/gis/db/backends/postgis/base.py", line 26, in prepare_database
    cursor.execute("CREATE EXTENSION IF NOT EXISTS postgis")
  File "/home/hsn/env_banax_api/lib/python3.6/site-packages/django/db/backends/utils.py", line 100, in execute
    return super().execute(sql, params)
  File "/home/hsn/env_banax_api/lib/python3.6/site-packages/django/db/backends/utils.py", line 68, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/home/hsn/env_banax_api/lib/python3.6/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/home/hsn/env_banax_api/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
  File "/home/hsn/env_banax_api/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/hsn/env_banax_api/lib/python3.6/site-packages/django/db/backends/utils.py", line 83, in _execute
    return self.cursor.execute(sql)
django.db.utils.ProgrammingError: permission denied to create extension "postgis"
HINT:  Must be superuser to create this extension.