From the course: Full Stack Web Development with Flask
Unlock this course with a free trial
Join today to access over 24,400 courses taught by industry experts.
Creating the data models - Flask Tutorial
From the course: Full Stack Web Development with Flask
Creating the data models
- [Instructor] Creating the Data Models. In this video, we're going to create the data models for our application. We'll create the User model, the Course model, and of course the Enrollment model. The creation of that model is just a typical class like this in Python. So, let's go into Visual Studio Code and start creating these models right away. In here, I'm going to open the application here. We need to create a models module instead of creating inside the routes. For example, in here, we created one for the user and we're going to move this out into a models module. Again, it's separation of concerns, right? Let's go ahead and create a new file. We'll call this models.py. And in here, I'm going to import the flask, from application and then import the db. I'm going to copy the User's class Just copy this. Cut this, actually. Save that, and then move it to this location. And then, we'll create two more models.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.