- Python 3.x
- GDAL (for data imports)
Running the app locally
Clone this repository and
cdinto your local copy.
git clone email@example.com:datamade/just-spaces.git cd just-spaces
Create a virtual environment. (We recommend using
virtualenvwrapperfor working in a virtualized development environment.)
mkvirtualenv -p python3 just-spaces
Install the Django requirements.
pip install -r requirements.txt
Copy the example local settings file to the correct location:
cp just-spaces/local_settings.example.py just-spaces/local_settings.py
Create the database:
python manage.py migrate
Make a superuser for so that you can access the admin interface:
python manage.py createsuperuser
Django should prompt you to provide a username, email, and password.
Initialize PLDP data:
python manage.py initialize_pldp
Load ACS data:
python manage.py import_data
python manage.py import_survey_templates
Run the app locally!
python manage.py runserver
Navigate to http://localhost:8000/.
Importing new ACS data
If you'd like to refresh ACS data, there are a few steps you'll need to take:
- If your database is running in production, make a backup of it with
pg_dumpjust in case
- Follow the instructions in the
datarepo to remake ACS data for a new year
python manage.py import_data
import_data management command will update data if it already exists, so you shouldn't experience data loss during import. Still, we recommend that you practice caution and make a backup.
import_data can take a long time to finish, you can pass in flags that will tell it to only run certain parts of the data import pipeline. These flags follow the format
--blockgroups-only). These flags can be useful if, for example, you're only actively developing one part of the import pipeline (like the Census block group import) and you don't want to have to wait for the rest of the job to finish in order to test your work. For full documentation of the available flags, run
./manage.py import_data --help.
This app employs three classes of users:
Field userscan run published surveys.
Staff usershave all the permissions of field users. They can also create, edit, and delete Agencies, Studies, Study Areas, Surveys, and Locations. They can publish surveys so they can be run by field users. Staff users can also view all collected data and design data visualizations on the collected data pages.
Superusershave all the permissions of staff users. They can also create, edit, and delete other users. Only superusers can set and change user passwords. All superusers should also have staff status.
In addition, list views for entities like Studies, Surveys, and CensusAreas will provide filtered results based on the Agency assigned to the current user. If a user has no Agency assigned, the user will see unfiltered results for the entity in question. This can be useful to provide users with full visibility over all entities in the system.
On form building
This app uses a custom fork of django-fobi for the Create Survey, Edit Survey, and Run Survey views. django-fobi's documentation is an immensely helpful resource. Add-ons to the base are in this repo's
fobi-custom folder, including custom plugins that draw from
django-pldp, our implementation of the Public Life Data Protocol.