/Trash-Muncher-Webapp

Location based cookie-clicker based in the campus of the University of Exeter to incentivise recycling.

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

Trash-Muncher-Webapp

Contents


Overview

Trashmunchers is a location based game developed to promote sustainability at the University of Exeter. The objective of the game is for players to feed Trashmonsters at different recycling points scattered across campus in order for their team to gain control of the Trashmonsters. Players can visit their nearest Trashmonster and take a picture of what they are recycling. By doing so, they are awarded a certain amount of points based on the size of what they recycled. In addition to this, they are given a certain amount of carbon dependant on the size of their trash to represent their impact on sustainability.

Styled using black.


Creating a developer user

Prerequisites:

  1. Have Python installed (Link to download: https://www.python.org/downloads/)
  2. Have pipenv installed (Steps to installation: https://pypi.org/project/pipenv/#installation)
  3. Have a local version of the repository (How to clone a repository: https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)

Steps:

  1. Open a terminal (Windows - PowerShell or Command Prompt, UNIX - Terminal)
  2. Open the src folder in a terminal

How to open src in terminal

  1. Run pipenv install to download all dependencies

How to install dependencies

  1. Enter the pip environment shell pipenv shell

How to enter pip environment

  • You should be met with a message confirming that you have entered the pipenv shell

pipenv shell confirmation

  1. Enter src folder cd src

How to enter src folder

  1. Create a developer user python manage.py createsuperuser

How to create a developer account

  1. Enter the details that you would like the account to have (username, email and password)

Entering user details

  1. If already deployed, go to host-ip/admin (for us: http://38.242.137.81:8000/admin/) and login
    • If it hasn't been deployed (being run locally), run python manage.py loaddata teams to initialise the teams
    • Then, run python manage.py runserver
    • Go to localhost:8000/admin and login to see if it was successfully created

Admin login page

  1. Now, you can manage all users, teams and trashmonsters in the database. (It is also possible to edit team names in src/trashusers/fixtures/teams.json)

File structure

.
├── github                  # Used to update backend host link 
├── design_documents        # Markdowns containing information about game and technical design choices
    │ ├── .obsidian               # JSONs for styling markdowns  
    │ ├── GDD.md                  # Information about game design choices
    │ ├── TDD.md                  # Information about technical design choices (Needs to be completed)
    │ └── TrashImagesApp.md       # Instructions on how to run the TrashImages APIs locally to ensure that they can be used for deployment
├── src                     # Source files 
│ ├── assests                 # JSONs for styling markdowns  
│ ├── media/images            # Contains the images submitted by users
│ ├── trashimages             # Django app used for image handling
    │├── migrations             # Used to create tables in the database from models.py  
    │├── __init__.py
    │├── admin.py               # File where models are registered on the admin site for use by the admin
    │├── apps.py                # Name of the application  
    │├── models.py              # Definition of the tables 
    │├── serializer.py          # Outlines the JSON format that requests will be received/sent in  
    │├── tests.py               # Unit tests for this API
    │├── urls.py                # List of registered urls that lead to endpoints                
    │└── viewsets.py            # Outlines what happens when a user accesses a URL. For more info, visit https://www.django-rest-framework.org/api-guide/viewsets/
│ ├── trashmain               # Main Django app for configuration (Initial API endpoint)
	│├── __init__.py  
	│├── asgi.py
	│├── auxillary.py           # Used to get a player's team 
	│├── permissions.py         # Used to check if a player is a gamekeeper or a player to restrict them from certain endpoints   
	│├── settings.py            # Contains settings used for configuration to ensure that the app runs as intended. Must include created APIs in INSTALLED_APPS
	│├── urls.py                # List of registered urls that lead to endpoints. Defined for every application created               
	│└── wsgi.py    
│ ├── trashmonsters           # Django app for handling the game's monsters
    │├── migrations             # Used to create tables in the database from models.py  
    │├── __init__.py
    │├── admin.py               
    │├── apps.py                # Handles server startup to ensure that database isn't constantly recreated and overwritten
    │├── config.json            # Contains "monster eating" interval and maximum distance leeway   
    │├── jobs.py                # Handles the score decreasing methods using a scheduler    
    │├── models.py              
    │├── serializer.py 
    │├── tests.py               # Unit tests for this application
    │├── urls.py                                
    │└── viewsets.py 
│ ├── trashusers              # Django app for handling users
	│├── fixtures                
		│├── teams.json       # JSON file that is used to create three teams on startup 
	│├── migrations               
	│├── __init__.py
	│├── admin.py               
	│├── apps.py                 
	│├── models.py               
	│├── serializer.py            
	│├── tests.py               
	│├── urls.py                                
	│└── viewsets.py             
│ ├── db.sqlite3              # Database where information is stored 
│ ├── manage.py               # Autocreated by Django. Used for executing Django related tasks (e.g., running the server)
│ └── requirements.txt        # List of dependencies used for deployment
├── trashmunchers           # Contains cache files
    │├── trashmunchers/__pycache__        
    │└── trashsite/__pycache__         
 
├── .gitignore              # Prevents certain files from being pushed to the repository
├── Dockerfile              # Used to install the latest dependencies upon deployment 
├── Pipfile                 # Contains all project dependecies required for the application to be built 
├── Pipfile.lock            # Declares all project dependecies, their latest available versions and the hashes for those files
├── INFOFORGROUP.txt        # Information for development team on how to maintain program
├── docker-compose.yml      # Used to run the Django server through Docker 
├── readme.md               
├── requirements.txt        # List of dependencies used for deployment
├── run-docker.sh           # Shell script to run the Docker server 
├── Trashmunchers Testing Strategy.pdf           # Document outlining the testing strategy used for this product
├── LICENSE           # License used for this repository  
└── api_documentation.md    # Information about API endpoints

Privacy Policy 🔒

Privacy policy

License 📃

License: GPL v3


Contributors 💻

Owen Lee
Owen Lee
Ellie Kelemen
Ellie Kelemen
William Liversidge
William Liversidge
Vignesh Mohanarajan
Vignesh Mohanarajan
Scarlett Parker
Scarlett Parker
Malik Besta
Malik Besta