MySQL for Python Developers
Sequence
Setting up the Flask project
Sequence

In this video, we'll walk you through the process of setting up the project, cloning a GitHub repo, installing necessary dependencies, and getting your app up and running. After completing this video, you'll be prepared to focus on creating a database schema and writing SQL statements for the app.

Cloning the GitHub repo

To get started, you'll first need to clone the provided GitHub repository, which contains some starter files for the app.

  1. Open your terminal and navigate to the desired location on your computer for the project files.
  2. Enter the following command to clone the repo:
Terminal
git clone https://github.com/planetscale/mysql-for-python-developers.git

Moving the starter directory

After cloning the repo, you'll want to create a new folder and move the starter directory into it. This can be done using the Move-Item command on Windows or the mv command on Linux or Mac.

If you're on Windows:

Terminal
Move-Item .\mysql-for-python-developers-course\web-app\starter .\hotel-management-flask\

Next, open up the newly created hotel-management-flask folder in your favorite text editor.

Creating a virtual environment

A virtual environment is crucial for managing the Python dependencies for your Flask app. To create a virtual environment, follow these steps:

  1. Open a terminal and navigate to the hotel-management-flask directory.
  2. Create a virtual environment using the following command:
Terminal
py -m venv env
  1. Activate the virtual environment:

On Windows:

.\env\Scripts\activate

On Linux or Mac:

Terminal
source env/bin/activate

Installing required dependencies

With your virtual environment activated, it's time to install the required dependencies for your Flask app. Run the following command in your terminal:

Terminal
pip install -r requirements.txt

This will install all the necessary packages and dependencies for the app, as specified in the requirements.txt file.

Running the Flask app

Finally, you can run your Flask app using the following command:

Terminal
flask run

This will start the app on your local machine, and you should see a link to a local host address in your terminal output. Copy the URL and paste it into your browser to view the app. You should see a "No reservations in the system" message, which signifies that you have successfully downloaded the files and set up the app on your machine.

Next steps

Now that your app is up and running, you can proceed with the next steps in the tutorial series. In the following posts, we'll cover creating a database schema for your hotel management app, writing the necessary SQL statements to interact with the database, and building out the app's functionality.

About this lesson

Get your hotel management app set up by cloning the Flask repo and installing dependencies.

02:20
Closed captioned

Meet your instructor, Anthony Herbert

Software Developer

I'm a software developer and educator focused on helping others build their dream software projects.

Feedback or questions? Reach out to our team at education@planetscale.com.

By submitting your email, you agree to the processing of your personal information by PlanetScale as described in the Privacy Policy.