source code hosted at https://github.com/JustinMaxwell/PYH-Calculator Webapp hosted from https://www.pythonanywhere.com/user/jkmaxwell/ Webaddress: pyhcalculator.com
- Fork project in github.
git pull
orgit clone
from github to local filesystem.- Start virtualenv
- If it's not installed
pip3 install virtualenv virtualenvwrapper
- run
mkvirtualenv myvirtualenv --python=/usr/bin/python3.6
- To re-activate run
workon myvirtualenv
to deativate rundeactivate
- If it's not installed
- pip install from requirements.txt
- cd into git repo directory.
- run
pip install -r requirements.txt
- Create new local branch for changes
git checkout -b <new-branch-name>
- Check changes to markdown (MD) with grip.
grip <file.md>
- If it's not installed
pip3 install grip
- If it's not installed
- Do updates, edits, and code, test
flask run
- if $FLASK_APP isn't set,
export FLASK_APP=<flask_app.py>
, first. Thenflask run
.
- if $FLASK_APP isn't set,
- Switch back to master and merge new branch into master
git checkout master; git merge <new-branch-name>
git commit -a -m 'message'
git push origin master
- Easy way:
git push pythonanywhere
. This will push the master branch to the pythonanywhere bare repo and trigger a hook to build the app. - More comprehensive way:
- From pythonanywhere.com console run
git pull origin master
. That will replace the current running Flask app with the master branch's head commit. - Run
pip3 install -r requirements.txt
- If the virtualenv is not activated, then you'll get permission errors. run
source bin/activate
to activate, anddeactivate
when/if done.
- If the virtualenv is not activated, then you'll get permission errors. run
- Reload webapp from "pythonanywhere.com/user/jkmaxwell/webapps/#tab_id_www_pyhcalculator_com"
- Or from an ssh session run
reload_app.sh
. this just runs thetouch
command on "/var/www/www_pyhcalculator_com_wsgi.py"
- Or from an ssh session run
- From pythonanywhere.com console run
- If that worked created a tag/release and push it to origin.
How to get this running on a digitalocean droplet: https://www.digitalocean.com/community/tutorials/how-to-structure-large-flask-applications