The visualization is completed and avaliable on http://flask.kahungchong.com
Flask is used as framework
To set up flask environment:
-
Create and enter an virtual environment for python
For anaconda on MacOS, type in terminal:
Conda create -n envName PYTHON=3.6 Source activate envName
-
Install corresponding package, type in terminal:
conda install flask conda install pandas
After setting up, there are two ways to run the server:
- Terminal
flask run
way
-
Change environment path, open the project folder in the terminal/cmd.
-
For MacOS, type:
export FLASK_APP=horse_racing_visualization.py
-
For Windows, type:
set FLASK_APP=horse_racing_visualization.py
-
-
Flask debug mode allows refresh server automatically when script changes.
-
For MacOS:
-
Turn on debug mode, in terminal, type:
export FLASK_ENV=development
-
Turn off debug mode, in terminal, type:
export FLASK_ENV=
-
-
For Windows:
-
Turn on debug mode, in terminal, type:
set FLASK_ENV=development
-
Turn off debug mode, in terminal, type:
set FLASK_ENV=
-
-
-
Run the server, type in terminal
flask run
- Run python script way
-
Just run
Horse_Racing_Visualization/app/flaskapp.py
, then the server will start. -
To turn on debug mode, just change the last line of
flaskapp.py
filefrom
app.run()
toapp.run(debug=True)
After the server is running, to open the website:
-
In brower (Chrome is preferred), type the following as url
localhost:5000
Some remarks:
-
If you are using vscode:
-
Firstly please select the python interpreter to the virtual environment
envName
in the buttom of vscode. -
Secondly press
cmd + shift + x
to open vscode extension, then installDjango Template
and reload.
-