12 Database: We need good storage

 

In this chapter

  • Simon proposes a separate folder for the application
  • Erik and Emily move the application files to the new folder structure
  • Erik reuses the functions for reading text files
  • Erik and Emily learn about databases
  • Simon helps Emily and Erik change the application to use a database

“Let’s make our project a bit more serious,” Simon said when the friends met the next time.

“Yesterday, you said something about a database,” Erik said. “Is that what you mean?”

“Yes, that too,” Simon answered. “But first, I suggest we make changes in our folder structure. Let’s organize our files. Look at our files and folders.”

He took a piece of paper and started drawing and explaining.

“When we started with the Mu editor, it placed all our programs in its default folder, which is mu_code. Then we discovered that it also has all the necessary templates for web applications under the templates folder inside mu_code. If you look at it in the file manager—Finder on macOS or Explorer on Windows—you’ll see that it also has more folders, such as static, images, fonts, and so on. Remember, we already created a couple of templates ourselves, order.html and print.html, and we placed them under templates. If you look into the static folder, you’ll find the css folder—I think you, Emily, know that it’s for style sheets—and there are a couple of files there.

New things you have learned today

Code for this chapter