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.
To get started, you'll first need to clone the provided GitHub repository, which contains some starter files for the app.
- Open your terminal and navigate to the desired location on your computer for the project files.
- Enter the following command to clone the repo:
git clone https://github.com/planetscale/mysql-for-python-developers.git
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:
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.
A virtual environment is crucial for managing the Python dependencies for your Flask app. To create a virtual environment, follow these steps:
- Open a terminal and navigate to the
hotel-management-flask
directory. - Create a virtual environment using the following command:
py -m venv env
- Activate the virtual environment:
On Windows:
.\env\Scripts\activate
On Linux or Mac:
source env/bin/activate
With your virtual environment activated, it's time to install the required dependencies for your Flask app. Run the following command in your 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.
Finally, you can run your Flask app using the following command:
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.
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.