WebFaction
Community site: login faq

Somewhat related to https://community.webfaction.com/questions/10150/installing-postgis-20

I am on a new server with PostGIS2 and created a new database with PostGIS enabled.

Via psql selecting the version confirms this:

> SELECT postgis_full_version();
NOTICE:  Function postgis_topology_scripts_installed() not found. Is topology support enabled and topology.sql installed?
                                                                         postgis_full_version

--------------------------------------------------------------------------------------------------
--------------------------------------------------------------------
 POSTGIS="2.1.8 r13780" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1
.11.0, released 2014/04/16" LIBXML="2.9.1" LIBJSON="UNKNOWN" RASTER
(1 row)

However PostGIS is not visible as extension:

> \dx
                 List of installed extensions
  Name   | Version |   Schema   |         Description          
---------+---------+------------+------------------------------
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
(1 row)

This confuses Django, when running migrations, which is checking that in the backend (https://github.com/django/django/blob/master/django/contrib/gis/db/backends/postgis/base.py):

django.db.utils.ProgrammingError: permission denied to create extension "postgis"
HINT:  Must be superuser to create this extension.

Someone asked support about this already and posted on reddit: https://www.reddit.com/r/django/comments/426fd0/geodjango_with_migrations_on_webfaction_no/

However editing the Django source is not a practical long term solution. Why is the extension not visible?

asked 10 Apr '16, 23:23

Florian
13
accept rate: 0%


Update: As of today (21 April 2016), when you create a PostGIS database on any of our CentOS 7 servers (Web500 and up), PostGIS is installed as an extension and you should be able to run Django migrations with no problem.

For older servers, see below:

PostGIS isn't visible as an extension because at the present time, we do not install it as an extension. We install it the old way, via SQL.

We're looking into the possibility of changing that on our servers that use PostGIS 2+, but in the meantime, instead of modifying Django source, you can use a custom DB backend to work around the problem: custom postgis backend for WebFaction

Just save that file in some directory on your Python search path (making sure that the directory also has an __init__.py), and then set that package as your engine in your database settings, eg (assuming 'wfpostgis' is the directory name):

'ENGINE': 'wfpostgis',

Another option would be to use a private PostgreSQL instance to manage your databases, so you could install PostGIS as an extension yourself.

Hope that helps!

permanent link

answered 11 Apr '16, 00:50

seanf
12.2k41836
accept rate: 37%

edited 21 Apr '16, 23:59

thanks for opening an internal ticket, i also opened one: RQE-297404 to track internally. maybe you can add that as reference to yours to prevent separate people working on that.

(11 Apr '16, 14:10) Florian

answer updated

(11 Apr '16, 17:03) seanf

answer updated again :)

(21 Apr '16, 23:59) seanf

when you create a PostGIS database on any of our CentOS 7 servers (Web500 and up), PostGIS is installed as an extension

Should this actually read "when you create a Postgres database . . . "? I don't see an option for "PostGIS" in the control panel and my Postgres database shows "POSTGIS="2.1.8 r13780" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.0, released 2014/04/16" LIBXML="2.9.1" LIBJSON="UNKNOWN" RASTER" for SELECT postgis_full_version(); so I think that's correct.

(26 May '16, 13:57) tclancy

You should see the option to enable postgis and tsearch under the database itself when you create it. If you would like us to take a look for you, please open a ticket and let us know the database name you are looking at.

(26 May '16, 19:35) bmeyer71 ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×22
×9

question asked: 10 Apr '16, 23:23

question was seen: 2,272 times

last updated: 26 May '16, 19:35

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM