Saturday, July 11, 2015

Photo Voltiac Viability Map II

In a previous post I described installing the Photovoltaic Viability Map server software. I got the point where the 'make run' script was failing on connecting to the database.  In this post I'll describe how to get the database setup.

I have installed PostGIS on the Ubuntu 14.04 server using:

$ sudo aptitude install postgresql-9.3-postgis-2.1

There is an init.sql file included with the web app to setup the database:



When I run it with:
$ sudo su postgres
$ psql -d postgres -a -f init.sql
I get an error:
psql:init.sql:17: ERROR:  type "geometry" does not exist
A post on stack overflow told me I needed to run:
$ psql -d postgres -c "CREATE EXTENSION postgis;"
After running this, init.sql ran without error, but 'make run' has a new problem:
$ make run
python3 httpserver.py
Traceback (most recent call last):
  File "httpserver.py", line 17, in <module>
    host=app.config["DBHOST"]
  File "/usr/lib/python3/dist-packages/psycopg2/__init__.py", line 179, in connect
    connection_factory=connection_factory, async=async)
psycopg2.OperationalError: FATAL:  database "test" does not exist

make: *** [run] Error 1
I ran:
$ egrep test *
and found:
flaskconfig.py:DBNAME = 'test'
After changing 'test' to 'postgres', I have a running server:
$ make run
python3 httpserver.py
[15-07-11 11:57:54][NOTE] Starting server
 * Running on http://0.0.0.0:5000/
 * Restarting with reloader
[15-07-11 11:57:54][NOTE] Starting server
Connecting to it from the browser on my desktop machine, I see:
My next task will be to populate the database with data.

No comments:

Post a Comment