Skip to content

za-grad/otvoreni-akti

Repository files navigation

Live App

You can check out the live version of Otvoreni-Akti here: https://akti.za-grad.com

Development

Set up a virtualenv:

python3 -m venv --prompt otvoreni-akti .venv
source ./.venv/bin/activate
pip install -r requirements.txt

Copy and modify the config file to your liking:

cp .env.example .env
cp Procfile.dev.example Procfile.dev

Set up the database:

mkdir -p tmp/postgres
initdb tmp/postgres
postgres -D tmp/postgres -p 5432
psql postgres -p 5432 -c "create user otvoreniakti with password 'otvoreniakti';"
psql postgres -p 5432 -c "create database otvoreniakti encoding 'utf8' template template0 owner otvoreniakti;"
psql otvoreniakti -p 5432 -c "create extension hstore;"

Then when normally developing:

honcho -f Procfile.dev start

Scrape the web and populate Django DB for Zagreb:

python manage.py migrate
python manage.py shell
from otvoreni_akti.apps.scraper_zagreb import scrape

To scrape everything: scrape.start()

To perform a limited scrape of last 3 periods scrape.start(max_periods=3)

To rescrape last few entries scrape.rescrape()

Scrape the web and populate Django DB for Split:

python manage.py migrate
python manage.py shell
from otvoreni_akti.apps.scraper_split import scrape

To scrape everything: scrape.start()

To perform a limited scrape of last 3 periods scrape.start(max_periods=3)

Scrape the web and populate Django DB for Rijeka:

python manage.py migrate
python manage.py shell
from otvoreni_akti.apps.scraper_rijeka import scrape

To scrape everything: scrape.start()

To perform a limited scrape of last 3 periods scrape.start(max_periods=3)

Running Elasticsearch:

Download and install Elasticsearch from the official website. Then run this command:

python manage.py search_index --rebuild

Run the Django server (if not running):

python manage.py runserver