Skip to content

Example on making changes on UI, DB schema

Brandon Myers edited this page Aug 13, 2020 · 6 revisions

Example on modifying templates

  1. Run the app on local server (http://127.0.0.1:5000/) by command "python app.py /d/edusample", then browse to the page where I want to make changes
  2. For example, project_profile.html using chrome, press F12, then Ctrl + Shift + C (or the button on the image), click on the element that I want to change: example
  3. Add changes in the style tab on the bottom right corner, that way I am able to see immediate changes on the left side: example1
  4. Then copy and paste modifications to the templates

Example of modifying Database Schema

  1. Make changes to the Table classes in the python file, or add a new class to add in a new table: example

Applying the modification to the local server (sqlite)

  1. To apply the modification to the local server, I can either delete existing database and rebuild or I can add changes manually to the account.db

    a. [rebuild]Delete account.db, then modifying the code at the bottom of app.py, and run the app using the same command to rebuild the database: example

    b. [make changes manually]In command line, cd to the folder where account.db lives in, then type "sqlite3 account.db" in cmd, then I'm ready to update changes to the current account.db.

Applying the modification to the production server (MySQL)

a. If you already have a changelist for the schema, you can write the needed ALTER commands that reflect those changes. To run them, either write a script or do it manually by logging into the MySQL shell.

b. If you are unsure of the changelist for the schema, you can reconstruct it by...

  1. log into the MySQL shell
  2. List all tables with

show tables;

  1. For each table, do the following.

show fields from tablename;

(replacing tablename with the name of the table) Compare the information with that in app.py to see if any changes are needed.