Skip to content

nategalit/branch-django

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌿 Branch | Community Connection Platform

Live App: https://branch-django.up.railway.app/
Original Streamlit Version: https://branch-app.streamlit.app/
GitHub: https://github.com/nategalit/branch-django


What is Branch?

Branch is a community connection platform that bridges the gap between volunteers and people in need of resources across Spokane, WA. Volunteers use the app to find opportunities and log hours, while community members use it to locate essential services like food pantries, shelters, and clothing drives.

This Django version is a full rebuild of an original Streamlit prototype β€” adding real user authentication, a production-grade admin panel, and cloud deployment.


Live Demo

Page URL
Dashboard https://branch-django.up.railway.app/
Resource Finder https://branch-django.up.railway.app/resources/
Log Activity https://branch-django.up.railway.app/log/
Sign Up https://branch-django.up.railway.app/signup/
Admin Panel https://branch-django.up.railway.app/admin/

Screenshots

Dashboard

Dashboard

Resource Finder

Resource Finder

Log Activity

Log Activity

Admin Panel

Admin Panel

Login Page

Login

Sign Up Page

Sign Up


What Changed: Streamlit β†’ Django

Feature Streamlit Version Django Version
User authentication ❌ None βœ… Full login/signup/logout
Admin interface Built manually (Page 4) βœ… Django admin (free, built-in)
Form validation Manual if checks βœ… Django ModelForms with clean()
Database queries Raw SQL via psycopg2 βœ… Django ORM
URL routing File-based (pages/) βœ… urls.py with named routes
Deployment Streamlit Cloud βœ… Railway (production-grade)
Templates Python widgets βœ… HTML templates with Bootstrap 5

Tech Stack

  • Backend: Python 3.14, Django 6.0
  • Database: PostgreSQL (Neon.tech)
  • Frontend: Bootstrap 5 (CDN)
  • Deployment: Railway
  • Auth: Django's built-in django.contrib.auth

Database Schema

Three tables power the app:

users β€” Tracks both Volunteers and Community Members, storing contact info and gamification points (1 hour = 100 points).

locations β€” Stores active community resources (Food Pantries, Shelters, Clothing drives, General Volunteering) and their addresses.

visits β€” The junction table linking users and locations, tracking when a user volunteers or receives resources.

Entity-Relationship Diagram

ERD


Key Features

  • Community Impact Dashboard β€” Live metrics showing total volunteers, community members, hours logged, and active locations. Recent activity feed with joined data across all three tables.
  • Resource Finder β€” Filter locations by service type or search by name. Powered by Django ORM's __icontains lookup (equivalent to SQL ILIKE).
  • Log Activity β€” Form with server-side validation: volunteers must log hours > 0, community members get hours set to null automatically. Successful volunteer submissions award points and update the user's total.
  • Gamification β€” 100 points per volunteer hour, tracked on each user's profile.
  • Django Admin β€” Full CRUD for Profiles, Locations, and Visits with search, filter, and list display. Replaces the manually-built "Manage Directory" page from the Streamlit version.
  • User Auth β€” Signup creates both a Django auth.User and a linked Profile in one transaction. Login/logout with session management and password hashing handled by Django.

How to Run Locally

1. Clone the repo

git clone https://github.com/nategalit/branch-django.git
cd branch-django

2. Create and activate a virtual environment

python -m venv venv

# Windows
.\venv\Scripts\Activate.ps1

# Mac/Linux
source venv/bin/activate

3. Install dependencies

pip install -r requirements.txt

4. Create a .env file in the project root

DB_NAME=your_db_name
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=your_db_host
DB_PORT=5432
SECRET_KEY=your-secret-key
DEBUG=True

5. Run the development server

python manage.py runserver

Visit http://localhost:8000


Project Structure

branch-django/
β”œβ”€β”€ core/                        # Main Django app
β”‚   β”œβ”€β”€ migrations/
β”‚   β”œβ”€β”€ templates/
β”‚   β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”‚   β”œβ”€β”€ base.html        # Shared navbar + layout
β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard.html   # Home page
β”‚   β”‚   β”‚   β”œβ”€β”€ resource_finder.html
β”‚   β”‚   β”‚   β”œβ”€β”€ log_activity.html
β”‚   β”‚   β”‚   └── signup.html
β”‚   β”‚   └── registration/
β”‚   β”‚       └── login.html
β”‚   β”œβ”€β”€ admin.py                 # Admin panel config
β”‚   β”œβ”€β”€ forms.py                 # VisitForm + SignupForm
β”‚   β”œβ”€β”€ models.py                # Profile, Location, Visit
β”‚   β”œβ”€β”€ urls.py                  # URL routing
β”‚   └── views.py                 # View functions
β”œβ”€β”€ myapp/                       # Django project config
β”‚   β”œβ”€β”€ settings.py
β”‚   β”œβ”€β”€ urls.py
β”‚   └── wsgi.py
β”œβ”€β”€ .env                         # Local secrets (not committed)
β”œβ”€β”€ .gitignore
β”œβ”€β”€ Procfile                     # Railway deployment
β”œβ”€β”€ railway.json                 # Railway config
β”œβ”€β”€ requirements.txt
└── manage.py

What I Learned

Moving from Streamlit to Django taught me how real web frameworks actually work:

  • Separation of concerns β€” Models, views, templates, and URLs each have a specific job. In Streamlit everything runs top-to-bottom in one file; Django forces you to think in layers.
  • Django ORM vs raw SQL β€” Writing Profile.objects.filter(account_type='Volunteer').count() is safer and more readable than raw psycopg2 queries, and handles SQL injection automatically.
  • Forms and validation β€” Django's ModelForm and clean() methods replace manual if checks and make validation reusable and testable.
  • What frameworks are for β€” Django's built-in admin, auth system, and CSRF protection are things I would have had to build from scratch in Streamlit. Frameworks exist so you can focus on your app's unique logic, not boilerplate security and CRUD.

Reflection

The biggest challenge was deployment β€” specifically, discovering that PythonAnywhere's free tier blocks outbound PostgreSQL connections (port 5432). Debugging that required reading error logs, testing connectivity with curl, and ultimately switching to Railway, which has no such restrictions. This kind of environment-specific debugging is something you don't encounter in a classroom but is completely normal in real software development.


Built as part of BMIS 444 β€” Project 1 | Gonzaga University

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors