Thanks to visit codestin.com
Credit goes to github.com

Skip to content

SJVAir/sjvair.com

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SJVAir

San Joaquin Valley Air Quality Monitoring Platform


🛠️ Tech Stack

  • Platform: Python, Django
  • Database: PostgreSQL with PostGIS
  • Cache: Memcached
  • Task Queue: Huey with Redis backend
  • Containerization: Docker (via docker compose)
  • Testing: pytest, Django test framework

🚀 Getting Started (with Docker)

Prerequisites

  • Docker Desktop installed and running.
  • Git and Python 3.11+ installed on your host (only needed for optional local scripts).

🔧 Setup Instructions

  1. Clone the repository

    git clone [email protected]:SJVAir/sjvair.com.git
    cd sjvair.com
  2. Build and start the dev environment

    docker compose --profile web up

    This will spin up the following services:

    • PostGIS (PostgreSQL + spatial extensions)
    • Redis
    • Memcached
    • Django web server
    • Primary task queue
  3. Create a superuser

    Once the containers are up:

    docker compose exec web python manage.py createsuperuser
  4. Build frontend assets

    docker compose exec web yarn install
    docker compose exec web invoke build
  5. Visit the app

    http://localhost:8000


🧪 Running Tests

docker compose run --rm test

Or with flags:

docker compose run --rm test pytest -s -x -k "test_something"

📦 Managing Dependencies

Python dependencies

Install a new Python dependency:

# Add it to requirements/base.txt or requirements/develop.txt first
docker compose exec web pip install new-lib-name

Frontend packages

Install frontend packages:

docker compose exec web yarn add new-js-lib

🛠️ Useful Commands

Run migrations

docker compose exec web python manage.py migrate

Open a shell in the web container

docker compose exec web bash

Import all regional data

(Note: This can take up to 20 minutes or more to finish, with import_land_use and import_protected_areas being the main culprits. These can be ommitted if necessary.)

docker compose exec web bash -c "
  python manage.py import_counties &&
  python manage.py import_census_tracts &&
  python manage.py import_cities &&
  python manage.py import_school_districts &&
  python manage.py import_zipcodes &&
  python manage.py import_congressional_districts &&
  python manage.py import_state_assembly &&
  python manage.py import_state_senate &&
  python manage.py import_urban_areas &&
  python manage.py import_land_use &&
  python manage.py import_protected_areas
"

🧹 Cleaning Up

Stop and remove all containers:

docker compose down

Start up again later:

docker compose --profile web up

🧠 Notes

  • .env and .env.test control environment-specific settings.

  • Profiles let you selectively spin up only needed services:

    # Start dev environment
    docker compose --profile web up
    
    # Run tests in isolation
    docker compose --profile test run --rm test
  • The database persists between sessions in the pgdata volume.


About

Monitoring the air quality in the San Joaquin Valley.

Resources

Stars

Watchers

Forks

Contributors 6