Skip to content

A redesigned daily USC Dining Hall Menu that allows users to get text & email notifications when their favorite items are available

Notifications You must be signed in to change notification settings

scottmai/trojan-dining

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trojan Dining

This is a redesign of the USC Hospitality daily dining hall menu, optimized for the mobile web experience. It will also allow users to subscribe to notifications for their favorite items.

Built by a TCSS 401x team :)

Setup Instructions


MongoDB Database

We are using a popular database called MongoDB for this project. MongoDB is notable for being a NoSQL database, differing from the traditional SQL table format with "SELECT * FROM ..." queries. NoSQL is preferred here due to the heavily nested menu data type it will be storing, as well as general flexibility for future use cases.

Installation

MacOS

  1. All instruction are on here - I recommend using this over the instructions below if anything doesn't work. Here's the shortened version:
  2. Install Homebrew
  3. Run brew tap mongodb/brew
  4. Run brew install [email protected]
  5. To run the database server: brew services start [email protected]
  6. To kill the database server: brew services start [email protected]

Windows

  1. https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/
  2. Download MongoDB installer from here.
  3. Run installer, do not check option for "Install MongoDB as a service", you may wish to install MongoDB compass for a graphical interface but its not necessary.
  4. You may need to restart you computer here ;.;
  5. Start the server (Ctrl-C to quit) (you must keep this terminal window open for as long as you want the server to run): . "C:\Program Files\MongoDB\Server\5.0\bin\mongod.exe" --dbpath=".db" (VS Code terminal windows are your friend!!!)

Backend

Setup

  • Create your database directory. mkdir .db

  • Install python 3.10

  • Install virtualenv

    • [Mac/linux] pip3 install virtualenv
    • [Windows] pip install virtualenv
  • Enter the backend directory: cd backend

  • Create virtual environment: python -m venv env

  • Activate virtual environment:

    • [Mac/linux]: source env/bin/activate
    • [Windows]: ./env/Scripts/activate
  • Install dependencies: pip install -r requirements.txt

  • If you install any new packages, make sure you activate your virtual environment first and then update the requirements.txt file with the new dependencies afterwards. This can be performed with the following command: pip freeze > requirements.txt

  • Setup Pylint with VSCode

    • Open your command palette (F1 or cmd/ctrl + shift + P)
    • Type "Python: Select Linter"
    • Select "Pylint"
    • Now, enable autoformatting by typing/selecting "Preferences: Open Settings (JSON)"
    • Find "[python]"
    • Add/update a field with "editor.formatOnSave": false
    • Save the settings.json file

Usage

  • Start the database in a separate terminal:

    • [Mac] brew services start [email protected]
    • [Windows] . "C:\Program Files\MongoDB\Server\5.0\bin\mongod.exe" --dbpath=".db"
      • Note: This must be performed from the root directory, not backend
  • Enter the backend directory: cd backend

  • Always make sure to activate the virtual environment when working in the backend:

    • [Mac/linux]: source env/bin/activate
    • [Windows]: ./env/Scripts/activate

  • Run whenever database models are changed (when in doubt run this):

    • python manage.py makemigrations
    • python manage.py migrate
  • Run the server:

    • python manage.py runserver
    • Note: if you receive a ModuleNotFoundError: No module named '<module-name>', try updating your dependencies with the pip install -r ... instructions above
  • When you're done, deactivate the virtual environment deactivate

  • And kill the database: brew services start [email protected]


Frontend

Setup

  • Install Node.js https://nodejs.org/en/download/

  • Enter frontend directory: cd frontend

  • Install yarn: npm install yarn -g

  • Install dependencies: yarn install

Usage

  • Start the frontend: yarn start

  • Run the mock API: npx json-server db.json -p 8000 --watch

  • Whenever you install a package, use yarn, not npm

    • You will often find instructions to install packages with npm install <package-name> or npm i <package-name>
    • Instead, use yarn add <package-name>
    • And always reinstall dependencies (i.e. after git pulling with yarn install
    • The package-lock.json that is generated by npm install will be ignored by the repo - we only want yarn.lock

Other stuff

I highly recommend trying out a bunch of VS Code extensions - here is a list I stole from saytama:

If you're using VSCode these are the extensions I recommend:

  • Django by Baptiste Darthenay - cuz we using Django
  • Git History by Don Jayamanne - lets you see git commit history in vscode
  • GitLens by GitKraken - so you know who wrote which big brain code
  • MagicPython by MagicStack - see below
  • Pylance, Python, VS IntelliCode by Microsoft - tbh idk which is better i just have them all lol
  • Code Spell Checker by Street Side Software - helps prevent whoopsies of spelling wrong variable names
  • vscode-icons by VSCode Icons Team or Material Icon Theme by Philipp Kief (prettier icons for your code editor)

About

A redesigned daily USC Dining Hall Menu that allows users to get text & email notifications when their favorite items are available

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published