2. Get started
• We will use Python and Flask for our Cloud service
• Part 1: Heroku
• https://www.heroku.com
• Install heroku cli tools
• https://devcenter.heroku.com/articles/heroku-cli
• Part 2: Pythonanywhere
• https://www.pythonanywhere.com
• Read about git
• https://git-scm.com/book/en/v2/Getting-Started-Git-Basics
• Be sure to have git installed on your system
• https://git-scm.com/download/win
Vincent Claes
3. Sign up or Log in @ www.heroku.com
Vincent Claes
4. Our Application
Vincent Claes
• Python Application
• https://www.python.org/
• Flask Python Library
• http://flask.pocoo.org/
• Code is on our local machine and not on www.github.com
5. Create a new pipeline
Vincent Claes
A pipeline is a dyno (aka
cloud worker - vm) that will
run your app
8. Add App
Vincent Claes
The App is the actual Python Application, on Heroku you can host
applications from different programming languages (Python, R, PHP,…)
We will build our application in a way that Heroku recognizes that we
used Python to program it.
15. Open CMD
• Open a commandprompt (cmd) and open (or create) a directory with
the following files:
• requirements.txt
• Procfile
• PXLApp.py
Vincent Claes
42. CURL REFERENCE
option purpose
-X specify HTTP request method e.g. POST
curl -X GET http://cteq.pythonanywhere.com
-H specify request headers e.g. "Content-type: application/json“
curl -H "Content-type: application/json" -X POST http://cteq.pythonanywhere.com -d '{"message: "Hi Python World!!!"}'
-d specify request data e.g. '{"message":“Hi Python World!!!"}’
curl -H "Content-type: application/json" -X POST http://cteq.pythonanywhere.com -d '{"message: "Hi Python World!!!"}'
--data-binary specify binary request data e.g. @file.bin
curl -H "Content-type: application/octet-stream" -X POST http://cteq.pythonanywhere.com -data-binary @file.bin
-i shows the response headers
curl -i http://cteq.pythonanywhere.com/hi
-u specify username and password e.g. "admin:secret“
curl -v -u "admin:pass" http://cteq.pythonanywhere.com/passneededcontents
-v enables verbose mode which outputs info such as request and response headers and errors
curl -v -u "admin:pass" http://cteq.pythonanywhere.com/passneededcontents
Vincent Claes
43. • More info: vincent[at]cteq.eu
• https://www.linkedin.com/in/vincentclaes/
• You can contact me for IoT, Embedded Systems (HW, SW, FPGA,
ARM,…) and ML/AI projects (R and Python).
Vincent Claes