-
Notifications
You must be signed in to change notification settings - Fork 1
Setup Guide
You will need to have Python installed. If you don't, you can download Python 3 for Windows or MacOs depending on your machine. You will need either at least Python 3.5 or at least Python 2.7.
It is recommended to install dependencies for this project in a virtual environment. Python 3 comes with venv, while Python 2 needs virtualenv. Instructions here are from Flask's docs.
On Unix machines, run the following in the project folder:
$ mkdir venv
$ python3 -m venv venv
On Windows, run the following in the project folder (Powershell):
> mkdir venv
> py -3 -m venv venv
If you are using Python 2, run this instead:
$ mkdir venv
$ python2 -m virtualenv venv
Before installing dependencies, activate the created environment:
$ . venv/bin/activate
On Windows:
> venv\Scripts\activate
Additional Windows (Powershell) Note:
If you are given an error message similar to this:
> venv\Scripts\Activate.ps1 cannot be loaded because running scripts is disabled on this system.
For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
Then, as administrator, try this before running the above command again:
> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
but remember to revert the Execution Policy when you are no longer using the application:
> Set-ExecutionPolicy Restricted -Scope CurrentUser
Within the activated environment and after you have cloned the code repository, run the following command to install dependencies (Windows/Unix):
$ pip install -r requirements.txt
This will install Flask with optional dependencies in your activated environment. If you do not need optional dependencies listed in the requirements file, you can edit requirements.txt before installing.
If you are running the application for the first time, you will need to initialize the database. Run the following to initialize the database:
$ flask init-db
You will follow these steps any time you want to run the application and have already activated the virtual environment, installed the dependencies, and initialized the database.
On Mac and Linux:
$ export FLASK_APP=flaskr
$ flask run
On Windows (PowerShell):
> $env:FLASK_APP = "flaskr"
> flask run
You will see a similar output in the terminal:
* Serving Flask app "flaskr"
* Environment: development
* Debug mode: on
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 855-212-761
You're almost done! Open your choice of internet browser. Visit http://127.0.01:5000 and you should be all good to start using the application! Head over to our User Guide to see how to use it! 👍