WEBVTT

00:00.000 --> 00:04.000
Backend development with Python Flask.

00:04.000 --> 00:10.000
In this video, we will understand the role of backend in web applications.

00:10.000 --> 00:15.000
Learn to create a flask application structure with folders and files.

00:15.000 --> 00:20.000
Implement user registration routes and database models in Flask.

00:20.000 --> 00:25.000
Test and run the Flask server to verify successful user registration.

00:25.000 --> 00:37.000
First, we open the web application that we created earlier during our front-end development video.

00:37.000 --> 00:41.000
We click on the registration button and fill out the form.

00:41.000 --> 00:49.000
When we click the submit button, pop-up appears with backend integration pending,

00:49.000 --> 00:51.000
because there's no backend connected yet.

00:51.000 --> 00:59.000
This means our front-end form has no server or database to handle the data.

00:59.000 --> 01:05.000
To fix this, we'll now move to visual studio code and start building the backend.

01:05.000 --> 01:09.000
Inside VS code, we create a new folder named backend.

01:09.000 --> 01:13.000
Inside this folder, we make another folder called app.

01:13.000 --> 01:18.000
This is where our flask application files will go.

01:18.000 --> 01:22.000
Next, create new file run.pi.

01:22.000 --> 01:28.000
Paste the main flask application code into the folder.

01:28.000 --> 01:33.000
We also create a new file named config.pi.

01:33.000 --> 01:39.000
This file will contain our app configuration details such as database connection and secret keys.

01:39.000 --> 01:45.000
Then, we create another file called check underscore db.py.

01:45.000 --> 01:52.000
Which will be used to test our database connection and ensure that everything is working properly.

01:52.000 --> 02:02.000
Now, inside the app folder, we create two more folders, one named root and another named models.

02:02.000 --> 02:13.000
In the models folder, we create file db.py for connecting our application to the database and create one more file.

02:13.000 --> 02:23.000
The user.py file defines the user model with fields like username, email, and password.

02:23.000 --> 02:30.000
Next, inside the roots folder, we first create a file named off.py.

02:30.000 --> 02:37.000
This file will handle user authentication and registration logic for our application.

02:38.000 --> 02:47.000
After that, we create another file called main.py, which manages the main roots such as the home page and dashboard.

02:47.000 --> 02:54.000
This folder structure helps us keep the project clean and well organized.

02:54.000 --> 03:02.000
Once all files are ready, we open a new terminal in VS code.

03:02.000 --> 03:09.000
And move into the backend folder using CD backend and then run the server using Python run.py.

03:09.000 --> 03:16.000
If everything is correct, Flask starts the development server and shows the address where it's running.

03:16.000 --> 03:21.000
Now, I go back to the browser and open our web application again.

03:21.000 --> 03:25.000
I fill out the registration form once more and click on submit.

03:25.000 --> 03:32.000
This time, our Flask backend receives the form data, processes it, and stores it in the database.

