Last active
August 12, 2020 10:39
-
-
Save morenoh149/3405311da48120135b9e81b7dfc837b6 to your computer and use it in GitHub Desktop.
django postgis install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Users/harrymoreno/.local/share/virtualenvs/litt-api-HgI9cQzm/lib/python3.6/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>. | |
""") | |
Traceback (most recent call last): | |
File "/Users/harrymoreno/.local/share/virtualenvs/litt-api-HgI9cQzm/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 24, in <module> | |
execute_from_command_line(sys.argv) | |
File "/Users/harrymoreno/.local/share/virtualenvs/litt-api-HgI9cQzm/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line | |
utility.execute() | |
File "/Users/harrymoreno/.local/share/virtualenvs/litt-api-HgI9cQzm/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute | |
self.fetch_command(subcommand).run_from_argv(self.argv) | |
File "/Users/harrymoreno/.local/share/virtualenvs/litt-api-HgI9cQzm/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv | |
self.execute(*args, **cmd_options) | |
File "/Users/harrymoreno/.local/share/virtualenvs/litt-api-HgI9cQzm/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute | |
output = self.handle(*args, **options) | |
File "/Users/harrymoreno/.local/share/virtualenvs/litt-api-HgI9cQzm/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 77, in handle | |
connection.prepare_database() | |
File "/Users/harrymoreno/.local/share/virtualenvs/litt-api-HgI9cQzm/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 "/Users/harrymoreno/.local/share/virtualenvs/litt-api-HgI9cQzm/lib/python3.6/site-packages/django/db/backends/utils.py", line 100, in execute | |
return super().execute(sql, params) | |
File "/Users/harrymoreno/.local/share/virtualenvs/litt-api-HgI9cQzm/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 "/Users/harrymoreno/.local/share/virtualenvs/litt-api-HgI9cQzm/lib/python3.6/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers | |
return executor(sql, params, many, context) | |
File "/Users/harrymoreno/.local/share/virtualenvs/litt-api-HgI9cQzm/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute | |
return self.cursor.execute(sql, params) | |
File "/Users/harrymoreno/.local/share/virtualenvs/litt-api-HgI9cQzm/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__ | |
raise dj_exc_value.with_traceback(traceback) from exc_value | |
File "/Users/harrymoreno/.local/share/virtualenvs/litt-api-HgI9cQzm/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. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generated by Django 2.0.3 on 2018-07-18 02:56 | |
import django.contrib.gis.db.models.fields | |
from django.db import migrations | |
from django.contrib.postgres.operations import CreateExtension | |
class Migration(migrations.Migration): | |
dependencies = [ | |
('polls', '0002_photo'), | |
] | |
operations = [ | |
CreateExtension('postgis'), | |
migrations.AddField( | |
model_name='event', | |
name='location', | |
field=django.contrib.gis.db.models.fields.PointField(null=True, srid=4326), | |
), | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> python manage.py makemigrations | |
> python manage.py migrate |
This worked for me
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
solution is to create the extension in the correct db. I had incorrectly created the extension in the default db for superuser.