Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

GeoNode 2.4 -> 2.10.1 migration


Create a role and a database for Django:

create role user with superuser login with password '***';
create database gn_24 with owner user;
\c gn_24
create extension postgis;

Restore backup:

psql gn_24 < sdi_django.sql

Run GeoNode migrations

Activate virtualenv and set the env vars:

. env/bin/Activate
export vars_210

Here is a vasr_210 sample - update it to your enironment:

export DATABASE_URL=postgis://user:***@localhost:5432/dbname
export GEODATABASE_URL=postgis://user:***@localhost:5432/geonode_data
export ALLOWED_HOSTS="['localhost', '']"
export STATIC_ROOT=~/www/geonode/static/
export GEOSERVER_LOCATION=http://localhost:8080/geoserver/
export GEOSERVER_PUBLIC_LOCATION=http://localhost:8080/geoserver/

Downgrade psycopg2:

pip install psycopg2==2.7.7

Apply migrations and download basic fixtures:

cd wfp-geonode
./ migrate --fake-initial
paver sync

Fix migrations for upload application:

delete from django_migrations where app = 'upload';
drop table upload_upload cascade;
drop table upload_uploadfile;
./ migrate upload

Upgrade psycopg2:

pip install -r geonode/requirements.txt

Create superuser

To create a superuser I had to drop the following constraints (we can re-enable if needed):

alter table people_profile alter column last_login drop not null;
./manage createsuperuser

Fix on database

For some reason some resources are unpublished:

UPDATE base_resourcebase SET is_published = true;

Remove a foreign key from account_account which is not used anymore (GeoNode dev team: maybe even better let's remove all of the account tables!):

ALTER TABLE account_account DROP CONSTRAINT user_id_refs_id_726cb6b4;
ALTER TABLE account_signupcode DROP CONSTRAINT "inviter_id_refs_id_49a7c0d9";

Fix the remote service layers by running this script:

python migration/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment