Skip to content

Project for Database Systems I at Simon Fraser University

Notifications You must be signed in to change notification settings

philip-L/CMPT354

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMPT354

Project for Database Systems I at Simon Fraser University

Front end

Download node.js with npm https://www.npmjs.com/get-npm

cd CMPT354/react-dynamicform

  1. npm add yarn

  2. yarn

  3. npm start

Backend

These are the steps I took on a MacOS environment.

Dependencies

  1. If you don't have Python, get it.

  2. Make sure you have Django installed (version 2.0.5 or later). Include the djangorestframework, and django-cors-headers. Reference: https://docs.djangoproject.com/en/2.0/intro/tutorial01/

     pip install django djangorestframework django-cors-headers
    
  3. MySQL version 5.7.22 is required (not latest) since mysqlclient only supports up to this. Download page: https://dev.mysql.com/downloads/mysql/5.7.html#downloads Reference: https://dev.mysql.com/doc/refman/5.7/en/

     - download the native package
     - make sure to use legacy encryption if asked
    
  4. Download mysqlclient 1.3.12 database connector in order to use django with mysql:

     pip install mysqlclient
    
  5. Also need sqlparse in order to run raw sql queries in migrations

     pip install sqlparse
    

This is all that is required to use django with mysql.

Creating the database (documentation: https://dev.mysql.com/doc/refman/5.7/en/)

After downloading the native package follow the install wizard to set things up. Refer to reference manual to create database.

You need to create a MySQL database with the following settings to match the django settings file:

   database name: SubAve
   user: root
   password: SubAvepwd

Useful commands:

To start the server:  mysqld_safe --user=mysql &
To stop the server:  mysqladmin -u root shutdown

When the MySQL server is running you run:

mysql -u root -p

When using the database shell:

CREATE DATABASE SubAve; 
SHOW databases;
USE SubAve;
SHOW tables;

Creating tables and populating the database (final steps)

This is done through django. It is accomplished through migrations (https://docs.djangoproject.com/en/2.0/intro/tutorial02/):

From inside the CMPT354/SubAve directory use these commands:

    To apply the migrations to populate database: python manage.py migrate
    To create a new migration: python manage.py makemigrations ordering
    To view the sql before applying a migration: python manage.py sqlmigrate ordering 0001

Finally run the following command to start the django server:

    python manage.py runserver

About

Project for Database Systems I at Simon Fraser University

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •