Flask Cheatsheet
Simple Flask example
+
from flask import Flask, render_template
app = Flask(__name__)
months = ['January', 'February', 'March', 'April', 'May', 'June', 'July',
'August', 'September', 'October', 'November', 'December']
@app.route('/')
def index():
return render_template('index.html', city='Portland, OR', months=months)
if __name__ == '__main__':
app.run(debug=True)
Install a python package |
|
Install a specific package version |
|
Uninstall a python package |
|
See what versions are available (use illegal version string!) |
|
Upgrade a package |
|
Package Management
List installed packages |
|
List installed packages |
|
Upgrade installed package |
|
Capture installed packages |
|
Install a dependencies file |
|
Deleting secondary dependencies, not so easy, hacky solution? :(
-
Capture your dependencies
pip freeze > requirements.ym;
-
Edit
requirements.yml
removing unwanted dependencies -
Make a new virtualenv
-
Install your new dependencies list
pip install -r requirements.yml