Installation
This page has all the information you will need to setup your project. Here you will get to know what are the things that you will need to install before you start working on your project. Make sure you don't miss a single step.
For Windows
Install Python
Flask is a Python web framework, thus requiring Python to be installed on your machine.
To install Python on your machine , follow the link https://python.org/download/, and download a Windows MSI installer for Python. Once downloaded, run the MSI installer and follow the on-screen instructions.
Once the installation is complete, open the command prompt and check the Python version by executing this command
python --version
If you encounter any problems, first make sure you have set the PATH variable
correctly. You
might need to
adjust your PATH environment variable to include paths to the Python executable and additional scripts.
For example, if your Python is installed in C:\Python34\, the following paths need to be
added to PATH:
C:\Python34\;C:\Python34\Scripts;
Install PIP
PIP is a package manager for Python that uses the Python Package Index to install Python packages. PIP will later be used to install flask from PyPI. If you've installed Python 3.4, pip is included so you may skip this section.
pip is pip installs packages
Step 1: To install pip first we need to download get-pip.py file. To do that
go to this
link https://bootstrap.pypa.io/get-pip.py and save
this
file by ctrl + s in the same file where the python is located.
Python is usually saved on this path:
C:\Users\User\AppData\Local\Programs\Python\Python310.
Step 2: Once this file is save, open the command prompt by typing cmd in your start
menu,then
navigate to where the get-pip.py is located in your system and run
the below given command
python get-pip.py
Now pip is installed in your system, you can check it through this command
pip --version
Install Flask
Now we have everything we need to install in Flask. We can easily install Flask by running this command in the command prompt.
pip install Flask
Aand we are done with setting up flask in our system, now you can code all you want in flask.
For Linux
Step 1: Updating System
Update your system by executing the below given command in your terminal.
sudo apt-get update
Step 2: Install Python
Although you already have python installed in your system, as it is included while installing any linux based os, but if it is not included run the following command to install python.
sudo apt-get install python3
Check the version of python through this command:
python3 -v
Step 3: Install pip
Pip is included with the python versions above 3.4. So if you have installed python version which is above 3.4 then you can skip this step
Run this command in the terminal to install pip
sudo apt-get install python3-pip
Step 4: Install Flask
Now we are all set to install flask in our system. Run this command in the terminal:
pip install flask
Setting Up Cuba
Now that you have installed flask in your system its time to setup the cuba theme and start creating you wonderful website.
Step 1: Check Flask Version
Make Sure that flask is installed in your system by running this command
flask --version
If it is not installed then make sure that you install it first by above given steps.
Step 2: Install dependencies
Info: Did you know that you can directly open the terminal at any given location.
If you are using a linux system, you can just go to the folder through your gui, and right click
anywhere in the empty space and click on open in terminal.
And if you are a windows user, just navigate to the folder through your gui, and in the address bar type cmd, and the current location will open in the command prompt.
Once you have navigated to the cuba folder, make sure that you have run.py in your
current directory,
you can check it by typing ls in your terminal (if using linux) or dir (if
using windows).
Now that we are in the right directory, run the below given commands to install all the dependencies one by one.
pip install libsass
pip install flask_sqlalchemy
pip install flask_login
pip install flask_admin
pip install flask_assets
pip install flask_wtf
pip install email_validator
Step 3: run the project
Now that all the dependencies are installed we are ready to run our project in the development server. Run the following command in the terminal:
flask --app run.py --debug run
open the link http://127.0.0.1:5000 in your browser to view the project.