0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ubuntu19.04にpostgisをインストール

Posted at
  • Ubuntu 19.04
sudo apt install postgresql-server-dev-11 postgresql-11-postgis-2.5
sudo su - postgres
createdb データベース名 --encoding='utf-8' --locale=en_US.utf8 --template=template0
createuser -P ユーザー名

psqlを実行します

postgres=# grant all privileges on database データベース名 to ユーザー名;
GRANT
postgres=# \q

psql データベース名を実行します

データベース名=# create extension postgis;
CREATE EXTENSION
データベース名=# \q

ctrl+dで抜けてください

Djangoの設定

pip install psycopg2-binary

settings.pyの'INSTALLED_APPS'にdjango.contrib.gisを追加

データベースの設定です

settings.py
DATABASES = {
    "default": {
        "ENGINE": "django.contrib.gis.db.backends.postgis",
        "NAME": "データベース名",
        "USER": "ユーザー名",
        "PASSWORD": "パスワード",
        "HOST": "localhost",
        "PORT": "",
    }
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?