Skip to content

Installation Instructions

Jim Hafner edited this page Mar 11, 2020 · 3 revisions

Install python3 if you haven't installed it yet.

python3 --version

If you do not see a version you will need to visit Python or google how to install it for your operating system. You want python3 as well as pip3.

Create a developer account on Github if you don't have one: Github

Fork the repository on Github, see: Fork a Repo

Clone your forked repository from the command line (this will create a GovLens directory):

git clone https://github.com/--your-github-name--/GovLens.git

Navigate to the base directory of the reposistory and prepare to install depedencies.

To start, it is recommend to create a virtual environment. If you have not used virtualenv before, install it with: pip3 install virtualenv.

# Create a virtual environment to manage dependencies
virtualenv venv
source venv/bin/activate

Now install the dependencies with pip:

# Install requirements.txt
pip3 install -r requirements.txt

After the dependencies have installed, we want to prepare the database.

# Perform data migrations
python3 manage.py migrate

Then, we need to import a CSV file containing existing agency information. Start by running a Django shell:

python3 manage.py shell

# From within the shell
>>> from apps.civic_pulse.utils.load_models import *
>>> fill_agency_objects()
>>> exit()

The following steps are needed in order to connect the api with the scrapers. If you do not wish to do that, then this may be skipped. We need to create a dummy user for the scraper to be able to access the api. The api is part of the Django projet. Note: The scrapers live in an independent environment not neccessarily in the same server as the Django website. The scrapers read and write data to the website using api endpoints.

  • create an admin user to be able to login to the admin portal of the website: /admin
  python3 manage.py createsuperuser --username admin --email [email protected]

  # enter the password when prompted. It can be any password that you wish to use.
  # It is used for login to the admin website.
  • Start up the webserver
python3 manage.py runserver

Navigate in your browser to http://127.0.0.1:8000/admin. Log in with the new admin user you just created. Click on Agencys and you should see a list of agencies created with the fill_agency_objects command.

To setup the scraper, read the scraper README.

Clone this wiki locally