gcivil-nyu-org / wed-fall24-team5

3 stars 0 forks source link

Food Waste Reduction App

Project Overview

This project aims to develop a mobile application that tackles food waste and food insecurity in NYC. It connects businesses, restaurants, and individuals with surplus food to users in need, promoting a more sustainable and equitable food system.

Problem Statement

Target Users

Vision Statement

Our vision is to create a platform that fosters a strong community network by connecting surplus food sources with those in need. By facilitating food donation, reduced prices, and efficient food access, we strive to:

Key Features

Getting started with Development

Project Structure

.
├── .github/               # GitHub workflows and settings
├── system_design_docs/    # System design documentation
├── src/                   # Django application root
│ ├── accounts/            # Sub-application for register / login / accounts
│ ├── database/            # Database schemas
│ ├── donor_dashboard/     # Sub-app for donor management
│ ├── django_management/   # Main Django project folder
│ ├── recipient_dashboard/ # Sub application for reserving donations
│ ├── static/              # Static files (CSS, JS, images)
│ ├── templates/           # HTML templates for front-end
│ └── manage.py            # Django management script
├── README.md              # This file
├── requirements.txt       # Requirements to be installed with pip
├── .travis.yml            # Setup for Travis CI / CD
├── .djlintrc              # Setup for HTML linting and formatting
└── .flake8                # Setup for Python linting and formatting

Prerequisites

Setup Instructions

  1. Clone the repository

    git clone https://github.com/gcivil-nyu-org/wed-fall24-team5
    cd wed-fall24-team5
  2. Set up a virtual environment:

    python3 -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Run database migrations

    python src/manage.py makemigrations
    python src/manage.py migrate
  5. Run development server

    python src/manage.py runserver

Development

Creating a new sub-application

  1. To create a new subapplication, change to the src/ folder and use the built-in Django startapp feature

    cd src
    python manage.py startapp [subapplication_name]
  2. Create a folder for the templates and static files for this subapplication.

    cd [subapplication_name]
    mkdir static templates templates/subapplication_name
  3. Add the src/subapplication_name/urls.py file to the subapplication

    touch urls.py
  4. Add the appropriate paths to the src/subapplication_name/urls.py file

    # Example src/subapplication_name/urls.py file
    from django.urls import path
    from . import views
    
    urlpatterns = [
      path('login/', views.login_view, name='login'),
      path('register/', views.register_view, name='register'),
      path('profile/', views.profile_view, name='profile'),
    ]
  5. Add the url path to the src/django_management/urls.py path

    # Example to add to urlpatterns in src/django_management/urls.py
    path('accounts/', include('accounts.urls')),
  6. Add the subapplication to src/django_management/settings.py

    INSTALLED_APPS = [
      ...
      # Other apps
      'accounts',
      'future_subapplication_names'
    ]

Branches

Pull Requests

Linting

This project uses flake8 and black for linting and formatting Python files and djlint for HTML templates. To run linting locally:

black ./src # This automatically reformats
flake8 ./src
djlint src/ --lint

Running tests and coverage

To run coverage tests locally:

coverage run --source='src' src/manage.py test

Deployment