Skip to content

Low Level Installation Documentation

Jessica Good edited this page Jul 22, 2014 · 12 revisions

Setup a Virtual Environment for the Metadata Repository

$ virtualenv --no-site-packages metadatarepoenv
$ cd ~/metadatarepoenv
$ source bin/activate   -  source Scripts/activate

Setup the Metadata Repository

(metadatarepoenv) $ git clone [email protected]:usgin/metadata-repository.git
(metadatarepoenv) $ cd /metadata-repository
(metadatarepoenv) $ pip install -r pip-requirements.txt

Setup Django

Create a new Django project called metadatarepo:

(metadatarepoenv) $ cd ..
(metadatarepoenv) $ django-admin.py startproject metadatarepo

Setup symlinks:

(metadatarepoenv) $ cd metadatarepo/
(metadatarepoenv) $ ln -s ~/workspace/metadatarepoenv/metadata-repository/metadatadb ~/workspace/metadatarepoenv/metadatarepo
(metadatarepoenv) $ ln -s ~/workspace/metadatarepoenv/metadata-repository/ui ~/workspace/metadatarepoenv/metadatarepo
(metadatarepoenv) $ ln -s ~/workspace/metadatarepoenv/metadata-repository/registry ~/workspace/metadatarepoenv/metadatarepo

Replace the content of metadatarepo/metadatarepo/urls.py with metadata-repository/dgn/urls.py

Setup Postgres Databases

(metadatarepoenv) $ sudo -su postgres
$ createuser -S -D -R -P metadatarepouser
$ createdb -T template_postgis -O metadatarepouser metadatarepo -E utf-8
$ psql -d metadatarepo -c '\dt'
$ psql -d metadatarepo -c 'ALTER TABLE geometry_columns OWNER TO metadatarepouser;'
$ psql -d metadatarepo -c 'ALTER TABLE spatial_ref_sys OWNER TO metadatarepouser;'
$ exit

Setup settings.py

Open /metadatarepo/metadatarepo/settings.py in an editor and edit the file using settings-example.py as a guide. Some settings are environment dependent.

Sync Django with Postgres

(metadatarepoenv) $ cd metadatarepo/
(metadatarepoenv) $ python manage.py syncdb

GeoDjango v1.4 might have deployed with a buggy version of libgeos. If it did, you won't be able to get past the above step without doing the following:

$ sudo nano ../python2.7/site-packages/django/contrib/gis/geos/libgeos.py
Change this:
$ version_regex = re.compile(r'^(?P<version>(?P<major>\d+)\.(?P<minor>\d+)\.(?P<subminor>\d+))((rc(?P<release_candidate>\d+))|dev)?-CAPI-(?P<capi_version>\d+\.\d+\.\d+)$')
To this:
$ version_regex = re.compile(r'^(?P<version>(?P<major>\d+)\.(?P<minor>\d+)\.(?P<subminor>\d+))((rc(?P<release_candidate>\d+))|dev)?-CAPI-(?P<capi_version>\d+\.\d+\.\d+).*$')

Create a Superuser

(metadatarepoenv) $ python manage.py createsuperuser

Use this to login at http://127.0.0.1:8000/admin/.

Start Django

(metadatarepoenv) $ python manage.py runserver