Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/issue 47/initial setup #48

Merged
merged 12 commits into from
Oct 3, 2024
Merged
8 changes: 8 additions & 0 deletions .djlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"exclude": "node_modules,venv,static",
"line-length": "88",
"ignore": "no-self-closing-tags,prefer-double-quotes",
"require": "require-doctype-first,prefer-compact-if",
"profile": "django",
"indent": "4"
}
21 changes: 21 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# [Issue ##](link-to-issue)

## Description

Replace this with a summary of your changes including any high-level business or decision-making context.

## Change Type (delete non-relevant options)

- 🪲 Bug fix (non-breaking change which fixes an issue)
- 💡 New feature (non-breaking change which adds functionality)
- 🌶️ Hotfix (quick & urgent software update deployed to fix a critical issue or bug)
- 🧹 Chore (maintenance tasks that don't add new features or fix bugs)
- 🌐 Release (for preparing a release branch)
- 🧪 Test (for adding tests)
- 📖 Doc (for documentation updates)
- 🔄 Refactor (for code refactoring and tech debt)

## Dependencies

- Call out here if this is dependent on another Pull Request, and paste the link if possible
- This branch contains a breaking change ⚠️
30 changes: 30 additions & 0 deletions .github/workflows/branch-name-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Branch Name Check

on:
pull_request:
types: [opened, synchronize]

jobs:
branch_name_check:
runs-on: ubuntu-latest

steps:
- name: Extract branch name
id: extract_branch
run: echo "BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV

- name: Check branch name format
run: |
# Retrieve the branch name from the environment
BRANCH_NAME=$BRANCH_NAME

# Convert branch name to lowercase
BRANCH_NAME_LOWER=$(echo "$BRANCH_NAME" | tr '[:upper:]' '[:lower:]')
echo "Branch name: $BRANCH_NAME_LOWER"

# Validate the lowercase branch name
if [[ ! "$BRANCH_NAME_LOWER" =~ ^(bugfix|feature|hotfix|chore|release|test|doc|refactor)/issue-[0-9]+[/-][a-z0-9_-]+$ ]]; then
echo "Branch name $BRANCH_NAME_LOWER does not follow the required pattern: branch-type/issue-###/short-description"
echo "branch-type must be one of: bugfix, feature, hotfix, chore, release, test, doc, refactor"
exit 1
fi
34 changes: 34 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Linting

on:
pull_request:
types: [opened, synchronize]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.x"

- name: Install dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install pylint pylint-django

- name: Run pylint
run: |
source venv/bin/activate
pylint src/

- name: Run djlint on templates
run: |
source venv/bin/activate
djlint src/templates/ --lint
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.env

# Python
*.pyc
__pycache__/

# Virtual environment
venv/

# Django
db.sqlite3

# Mac OS
.DS_Store
21 changes: 21 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[MASTER]
ignore=venv,migrations

[FORMAT]
max-line-length=92

[MESSAGES CONTROL]
disable=
C0114, # Missing module docstring
C0115, # Missing class docstring
C0116, # Missing function docstring
R0903, # Too few public methods
R0904, # Too many public methods
E1101, # No member (dynamic attribute in Django)
E0401, # Import error
W0212, # Access to a protected member
R0801, # Duplicate code
C0415, # Import outside top level

[REPORTS]
output-format=colorized
112 changes: 106 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,130 @@
# 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
### Problem Statement

- Food Waste: Businesses discard substantial amounts of surplus food daily, contributing to environmental and economic burdens.
- Food Insecurity: Many individuals and families, particularly in NYC's homeless population, face food shortages and limited access to healthy meals.

## Target Users
### Target Users

- Business Owners: Restaurants, delis, and grocery stores with surplus food to donate or sell at discounted prices.
- Food Insecure Individuals: People seeking affordable or free food.
- Community Organizations: Groups that coordinate food drives or manage community fridges.
- General Users: Individuals offering extra food from events or looking for discounted food options.

## Vision Statement
### 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:

- Reduce food waste and its associated environmental and economic impacts.
Combat food insecurity by providing access to nutritious food for underserved communities.
- Combat food insecurity by providing access to nutritious food for underserved communities.
- Promote sustainability within the food system by encouraging resourcefulness and reducing waste.
- Cultivate a culture of community care by enabling businesses, individuals, and organizations to contribute to a more equitable and food-secure society.

## Key Features
### Key Features

- Food Donations: Businesses/Restaurants/Users can list surplus food for donation
- Real-time food availability dashboard: Users can browse offerings from nearby businesses and individuals in real-time.
- Location-based search: Find nearby donation locations and discounted food options.
- Seamless communication: Users can coordinate food pickups or ask questions through messaging between the person picking up and the vendor or donor, not between donors or receivers.
- User Reviews and Ratings: Recipients can leave reviews and ratings for businesses and organizations, sharing their experiences to guide future users.
- Maps Integration: Locate nearby donation sites and community fridges with integrated Google Maps/similar maps for easy navigation.
- Maps Integration: Locate nearby donation sites and community fridges with integrated Google Maps/similar maps for easy navigation.

## Getting started with Development

### Project Structure

```
.
├── .github/ # GitHub workflows and settings
├── system_design_docs/ # System design documentation
├── src/ # Django application root
│ ├── manage.py # Django management script
│ ├── django_management/ # Main Django project folder
│ ├── static/ # Static files (CSS, JS, images)
│ └── templates/ # HTML templates for front-end
├── README.md # This file
├── requirements.txt # Requirements to be installed with pip
├── .djlintrc # Setup for HTML linting and formatting
└── .pylintrc # Setup for Python linting and formatting
```

### Prerequisites

- Python 3.x
- pip (Python package installer)
- Virtualenv (optional but recommended)

### Setup Instructions

1. Clone the repository

```bash
git clone https://github.com/gcivil-nyu-org/wed-fall24-team5
cd wed-fall24-team5
```

2. Set up the virtual environment:

```bash
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```

3. Install dependencies

```bash
pip install -r requirements.txt
```

4. Run database migrations

```bash
python src/manage.py migrate
```

5. Run development server

```bash
python src/manage.py runserver
```

## Development

### Branches

- Branches must be named as follows in order for a pull request with that branch to be accepted: `branch-type/issue-##/short-description`

- branch-type must be one of `bugfix`, `feature`, `hotfix`, `chore`, `release`, `test`, `doc`, or `refactor`

### Pull Requests

- Ensure your branch follows the appropriate naming conventions (above)
- While only one review is required, aim for two reviews.
- Do not resolve conversations you did not create. All conversations should be resolved before merging
- If your change after opening the Pull Request greatly modified your code, you should request a re-review
- All tests and lints should pass before merging
- Only the developer who opened the Pull Request should merge the Pull Request
- Always use `Squash and merge` to keep the commit history clean
- Delete branch after merging to keep the branch tree clean

## Linting

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

```bash
pylint src/
djlint src/templates/
```

## Running tests

- More information will come as tests and coverage are added

## Deployment

- This application is set up for deployment using AWS Elastic Beanstalk. Detailed deployment instructions will be added when the application is ready for deployment.
24 changes: 24 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
asgiref==3.8.1
astroid==3.3.4
click==8.1.7
colorama==0.4.6
cssbeautifier==1.15.1
dill==0.3.9
Django==5.1.1
djlint==1.35.2
EditorConfig==0.12.4
html-tag-names==0.1.2
html-void-elements==0.1.0
isort==5.13.2
jsbeautifier==1.15.1
json5==0.9.25
mccabe==0.7.0
pathspec==0.12.1
platformdirs==4.3.6
pylint==3.3.1
PyYAML==6.0.2
regex==2024.9.11
six==1.16.0
sqlparse==0.5.1
tomlkit==0.13.2
tqdm==4.66.5
Empty file.
16 changes: 16 additions & 0 deletions src/django_management/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for src project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_management.settings')

application = get_asgi_application()
Loading
Loading