MPV is a data visualizer for the rock climbing website MountainProject.com. Utilizing the user's MP registered email address, MPV imports their ticked climbs, analyzes the data, and outputs a graphic visualization.
While Mountain Project has similar features available on each user's profile page, the aim for this app is to provide a more robust and analytical set of functions.
Currently, you can try the software at: mpv.zachw.io. Check it out!
MPV is currently in development. If you'd like to help out, feel free to jump in. :-)
-
In the
appdirectory, renameconfig.sample.pytoconfig.py. Open it and change the listed variables (minus related to MySQL). See the Configuration section below for additional help. -
From the project's root directory, execute
docker build -t mpv .(Make sure you have the.on the end of the command.) This will build a Docker image of MPV, using your supplied configuration. -
Still from the project's root directory, run
docker-compose up -d. This will start two Docker containers, one for MPV and another for the required MySQL database. -
Use Docker to log in to the MPV container:
docker exec -it container-id bash, substitutingcontainer-idfor the MPV instance.docker pswill show it to you. -
Once you have a terminal inside the MPV container, run
python3 -m app.setup.db_setup. This will load the required tables into the MySQL database, and only needs to be done once. -
Now, you should be able to open
127.0.0.1:5000in your web browser and see a running MPV!
Note: If/when you need to stop MPV using this method, simply run docker-compose stop from the project's root directory.
-
Make sure you have Python 3.6 installed on your machine, then run the following shell command:
pip install -r requirements.txt -
On your MySQL server, create a table called
mpv. Create a user and give them access to it. Or see next section on how to setup database from docker. -
In the
appdirectory, renameconfig.sample.pytoconfig.py. Open it and change the listed variables. See the Configuration section below for help. -
From your root project directory, run
python -m app.setup.db_setup. This will create and populate the required key tables in the MPV database. -
Now, start the application by using the shell command
flask runin the root project directory, and you should be up and running!
- Navigate to the root directory of the MPV project on your machine
- run
docker-compose -f docker-compose-mysql.yaml up - To connect to the local mysql database instance with
mysql -u root -p mpv -h 127.0.0.1 -P 3306 - Password for development is
password
This application looks for a config.py file located in the app directory of your project. With that in mind,
structure your file to look like the example below, changing any values as necessary.
SECRET_KEY = "super-secret-key"
WTF_CSRF_SECRET_KEY = "different-super-secret-key"
MYSQL_USER = "root"
MYSQL_PASSWD = "password"
MYSQL_ADDRESS = "127.0.0.1"
MYSQL_TABLE = "mpv"
MP_KEY = "Your_MountainProject_API_Key_Here"
TEST_ACCT = "Your_MountainProject_Email_Acount_Here"
MPV_DEV = True
SECRET_KEY is used by Flask and extensions to "keep data safe". Set it to a random value. In the same vein, WTF_CSRF_SECRET_KEY is used by the Flask-WTF module. Assign it a different random value.
MP_KEY is a Mountain Project API key, which you can get here. The TEST_ACCT variable is an email address connected to a Mountain Project account. It allows users to run the app without an account (via the link on the index page) and still show data. For more on MPV_DEV, see Development Mode below.
To add tests please add them in under the app/tests directory.
Testing is done via Pytest. For documentation please visit https://docs.pytest.org/en/latest/index.html
To run tests simply run the following shell command in the app directory: pytest
To improve performance time and reduce traffic to the Mountain Project servers, enable development mode by setting the MPV_DEV variable in config.py to True. This disables loading ticks into the database via dbload(), sets the userid and name to dev values via get_user_id(), and loads test_ticks.csv instead of pulling one down from Mountain Project via ticklist().
Note: Make sure you run the program normally at least once to build a suitable user database before enabling dev mode. You will have to rename that database 1111 in order for the program to function.
- Python3 - The controller
- Flask - The web framework
- Bokeh - The visualizer
- MySQL - The database
- Javascript - Front-end functions
Zach Wahrer - zachtheclimber
BenfromEarth - benjpalmer
MPV is licensed under the GNU General Public License. Check out the LICENSE for more details.
- Thanks to Doug Neiner and Chris Coyier for the awesome CSS background code.