Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.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
更改用于PostgreSQL和PostGIS的LC_CTYPE_Postgresql_Locale_Postgis_Geodjango - Fatal编程技术网

更改用于PostgreSQL和PostGIS的LC_CTYPE

更改用于PostgreSQL和PostGIS的LC_CTYPE,postgresql,locale,postgis,geodjango,Postgresql,Locale,Postgis,Geodjango,因此,我正在浏览GeoDjango教程,我被以下错误消息所困扰: postgres@lucid32:~$ createdb -E UTF8 template_postgis createdb: database creation failed: ERROR: encoding UTF8 does not match locale en_US DETAIL: The chosen LC_CTYPE setting requires encoding LATIN1. 我在谷歌上搜索并阅读了一些

因此,我正在浏览GeoDjango教程,我被以下错误消息所困扰:

postgres@lucid32:~$ createdb -E UTF8 template_postgis
createdb: database creation failed: ERROR:  encoding UTF8 does not match locale en_US
DETAIL:  The chosen LC_CTYPE setting requires encoding LATIN1.
我在谷歌上搜索并阅读了一些Ubuntu文档,但都没有用。如有任何见解,将不胜感激


我使用默认的Vagrant Box lucid 32来测试我的设置。

您需要将操作系统的区域设置设置为任何与utf8兼容的区域设置。运行
locale-a
获取您可以使用的区域设置列表,然后执行类似于
更新locale LANG=en_US.utf8
的操作,将en_US.utf8替换为您想要的任何区域设置。

最好只指定数据库的区域设置,并从中找出编码。所以使用类似

createdb--locale=en\u US.utf8 template\u postgis
看看这个:

在创建集群之前,可能需要配置区域设置

~#export LANGUAGE=en_US.UTF-8
~#export LANG=en_US.UTF-8
~#export LC_ALL=en_US.UTF-8
~#locale-gen en_US.UTF-8
~#dpkg-reconfigure locales

否则,请在登录postgresql时尝试以下操作:

create database databse_name with owner database_owner encoding='UTF-8'lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
需要-E UTF8和--locale=en_US.UTF8

$ createdb -E UTF8 -T template0 --locale=en_US.utf8 template_postgis

实际上,我最后做的是从PostgreSQL 9.4.5plus 1开始创建DB-E UTF8-T template0--locale=en_US.UTF8 template\u postgis
--locale=en_US.UTF-8
,用于添加template0