Appendix B. Pythonanywhere: Deploying Your Webapp

image with no caption

At the end of Chapter 5, we claimed that deploying your webapp to the cloud was only 10 minutes away.

It’s now time to make good on that promise. In this appendix, we are going to take you through the process of deploying your webapp on PythonAnywhere, going from zero to deployed in about 10 minutes. PythonAnywhere is a favorite among the Python programming community, and it’s not hard to see why: it works exactly as you’d expect it to, has great support for Python (and Flask), and—best of all—you can get started hosting your webapp at no cost. Let’s check out PythonAnywhere.

Step 0: A Little Prep

At the moment, you have your webapp code on your computer in a folder called webapp, which contains the vsearch4web.py file and the static and templates folders (as shown below). To prepare all this stuff for deployment, create a ZIP archive file of everything in your webapp folder, and call the archive file webapp.zip:

image with no caption

In addition to webapp.zip, you also need to upload and install the vsearch module from Chapter 4. For now, all you need to do is locate the distribution file that you created back then. On our computer, the archive file is called vsearch-1.0.tar.gz and it’s stored in our mymodules/vsearch/dist folder (on Windows, the file is likely ...

Get Head First Python, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.