Conteúdo do Curso
Flask Intensive Course: Web Development with Python
Flask Intensive Course: Web Development with Python
Start Project
Download IDE
We'll begin by creating a new project in the local IDE. An IDE, which stands for Integrated Development Environment, is a convenient tool with all the useful features for fast and easy development. or this course, I'll be using the PyCharm Community edition, which is free. Another excellent option is Visual Studio Code (VS Code), which shares a similar design with only minor interface differences.
Feel free to search for "PyCharm Community Edition" in your preferred search engine, such as Google.
Find the official Jet Brains site to download from origins:
Click on your OS (if you have a more fresh version than this one, you can stop on that).
And continue installing IDE locally on your computer as any other software.
Start a new project
Open your IDE (Integrated Development Environment) window and click on the new project button. In this example, PyCharm IDE is used, but you can use whatever IDE you prefer.
At the new window, let's rename the default project name on the recipes_app.
You don't need to change any of the default settings. If you wish, you can not mark the last box. Click on the Create button. Let's create a new file where we will write our application. Right-click on the recipes_app, hit New -> File, and write main.py.
If main.py was created automatically, you can skip creation and just erase the initial script from the file.
IDE interface
Now, you have your first standard PyCharm project. Let's look at the IDE interface:
- Сorresponds to the root of our project. By clicking on the button with the directory icon, you can hide the project's tool window to extend the editor window at the right;
- "Tool windows" are specialized windows attached to the workspace's bottom and sides. They provide access to tasks such as project management, source code search and navigation, integration with version control systems, running, testing, debugging, etc. We have opened the Terminal in the picture and will work with it during this project;
- "Editor window" where you actually write your code. It has tabs for easy navigation between open files;
- The "Status bar" provides quick access to the Python interpreter settings and indicates the project's status;
- The "Window header" has specific buttons, such as a bar with files to run, a run button, and a debug mode button.
Virtual environment
Let's stop at the important concept of the project. This is about the Python interpreter at the Status bar (4 in the picture). You can see that the interpreter in the picture has the Python 3.11 (recipes_app) name that consists of the Python version (you can have another one, and it’s normal) and the project name. Also, at the project tool window (2-nd label), we have a venv directory with all necessary settings for the project's virtual environment. If you do not have an automatically installed virtual environment, you can do this manually pretty fast.
You can find additional information in the Virtual Environment section.
For manual installation and activating the virtual environment, use these commands at your terminal window in the project directory:
On macOS:
On Windows:
Good job!
Obrigado pelo seu feedback!