Compare commits

..

2 commits

3 changed files with 11 additions and 5 deletions

View file

@ -2,7 +2,8 @@
## Setup ## Setup
* clone the project * clone the project
* install geoip and postgres from your local package manager * install geoip and postgis from your local package manager
* `$ sudo pacman -S postgis geoip`
* setup postgres on your machine, see e.g. https://wiki.archlinux.org/title/PostgreSQL * setup postgres on your machine, see e.g. https://wiki.archlinux.org/title/PostgreSQL
* `$ sudo su postgres` * `$ sudo su postgres`
* `$ initdb -D /var/lib/postgres/data` * `$ initdb -D /var/lib/postgres/data`
@ -10,13 +11,14 @@
* create postgres user * create postgres user
* `$ sudo su postgres` * `$ sudo su postgres`
* `$ createuser --interactive` -> "owl" role with relevant priviledges * `$ createuser --interactive` -> "owl" role with relevant priviledges
* create postgres database "matcher" * create postgres database "matcher" with hstore and postgis extensions
* `$ psql -U postgres` * `$ psql -U postgres`
* `> CREATE DATABASE matcher;` * `> CREATE DATABASE matcher;`
* `> ALTER DATABASE matcher OWNER TO owl;` * `> ALTER DATABASE matcher OWNER TO owl;`
* `> CREATE EXTENSION hstore;`
* `> CREATE EXTENSION postgis;`
* create the db tables * create the db tables
* TODO find out where credentials are stored * setup database credentials and name in default.py
* setup credentials in default.py
* `$ python create_db.py` * `$ python create_db.py`
* setup a venv * setup a venv
* enter the venv, e.g. in pycharm * enter the venv, e.g. in pycharm

View file

@ -1,5 +1,8 @@
"""Sample config.""" """Sample config."""
# POSTGIS
DB_USER = "owl"
DB_NAME = "matcher"
ID_TAGGING_SCHEMA_DIR = "/var/lib/data/id-tagging-schema" ID_TAGGING_SCHEMA_DIR = "/var/lib/data/id-tagging-schema"
ID_PRESET_DIR = "/var/lib/data/id-tagging-schema/data/presets/" ID_PRESET_DIR = "/var/lib/data/id-tagging-schema/data/presets/"

View file

@ -2,9 +2,10 @@
from sqlalchemy.schema import CreateIndex, CreateTable from sqlalchemy.schema import CreateIndex, CreateTable
from config.default import DB_USER, DB_NAME
from matcher import database, model from matcher import database, model
DB_URL = "postgresql:///matcher" DB_URL = f"postgresql://{DB_USER}@localhost/{DB_NAME}"
database.init_db(DB_URL) database.init_db(DB_URL)