Posts Pizza anyone?
Post
Cancel

Pizza anyone?

Welcome to # Pinocchio’s Pizza & Subs. Now you can order your favourite delicacies directly from our new website! home selection order

About the problem

This is my submission for CS50’s project 3. This project was started after watching all the lectures. The focus was on learning Django and mimicking the exact requirements of the customer (Pinnochio’s)

Features

  • Built using Django
  • Single page responsive design - The entire menu is on a single page - No need for reloading!
  • An interactive add to cart option - Choose individuals details and toppings after you choose your menu item in an interactive pop-up menu
  • View the details order before placing your order from the cart

Improvements

  • There is no login system at present. The naming system is only a proxy.
  • Add an option to view finished / previous orders

Installing

Requirements

  • Python 3
  • pip
  • PostgreSQL (SQLAlchemy)

Installing python dependencies using pip

Once you have installed the requirements, install all the dependencies using

1
pip3 install -r requirements.txt

Setting up a PostgreSQL database

  • Set up a PostgreSQL server on your local server and configure it. This tutorial might help.

    Note your name and password.

  • Create a database in psql (dbname)
  • Now once you have created an account navigate to web-dev/pizza/pizza/settings.py in replace <name>, <password> and <dbname> accordingly:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.postgresql_psycopg2',
          'NAME': <dbname>,
          'USER': <name>,
          'PASSWORD': <password>,
          'HOST': 'localhost',
          'PORT': '',    }
    }
    

Populating the database with menu items

Run the following commands to populate the menu

1
2
3
python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py loaddata fixtures/db.json

Running the server

You are good to go! Run the server using

1
python3 manage.py runserver

Note the port which is shown in the output of this command

Viewing and modifying the database (using Django-admin)

To view the database records, set up a Django superuser

1
python3 manage.py createsuperuser

Using these credentials, you can visit the admin site by visiting:

1
localhost:<port>/admin

(The default port is 8000)

Contributing

Feel free to contribute features / point out errors. Fork my repository and make a pull request.
I promise I’ll have a look!

This post is licensed under CC BY 4.0 by the author.

Contents

Comments powered by Disqus.