Skip to content
This repository has been archived by the owner on Nov 23, 2017. It is now read-only.

awkweb/CS542

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CS 542

Fall 2016 database management systems project: split restaurant bills.

Orders Dashboard

New Order

Drag & Drop Split

View Bill

Install & Setup

A (somewhat) comprehensive list of commands to get started.

1. Create Postgres database (see Loading Test Data for more)

2. Setup Python

> virtualenv -p path/to/python3.5 CS542
> pip install -r requirements.txt

3. Add .env file

source CS542/Scripts/activate
export APP_SETTINGS="config.DevelopmentConfig"
export DATABASE_URL="postgresql://[username]:[password]@localhost/[dbname]"

4. Sync DB with Flask models

> cd server
> python manage.py db init
> python manage.py db migrate
> python manage.py db upgrade

5. Install NPM dependencies

> npm install

6. Build & run the project

> npm run build
> cd server
> python manage.py runserver

Loading test data

At this point the database should now be ready to use. You can check that the tables have been loaded successfully into the database by running commands like the following:

> psql
postgres=# \c [dbname]
postgres=# \dt

This should result in a list of the tables in the database.

Finally, to get some data loaded into your database, run

postgres=# COPY employee(first, last, address, phone, email, city, state, zipcode) 
postgres=# FROM '/path/to/data/employees.csv' 
postgres=# DELIMITER ',' CSV HEADER;
postgres=# COPY dish(name, desc, cost, category, spicy_level, time_to_cook) 
postgres=# FROM '/path/to/data/dishes.csv' 
postgres=# DELIMITER ',' CSV HEADER;

If it isn't clear, the 'path/to/...' is whatever the path to the csv file is.

To view your sucessfully preloaded data, run

postgres=# select * from employee;

License

Released under the MIT license. See LICENSE for details.

About

F16 CS542 Database Management Systems

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published