Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Which course explains how to publish our Python web apps online?

Hello!

I have started the "Exploring Flask" track and searched the library but I cannot seem to find the course I am looking for... of maybe I am not querying the correct words..

Basically, I do not know how to take the Flask web app and deploy it online.

A lot of tutorials are available online but they all seem to point to additional resources like Google Cloud Services or PythonAnywhere for deployment/hosting. Is that standard?

I am seeking a course to learn how to deploy my projects unto my own servers, or my clients... I am with HostGator and my preliminary research points to needing to learn the SSH way to do it because shared hosting means I won't be able to install packages according to a reddit post from 2 years ago.

Finally, on Treehouse I found the Django step but I am guessing this is specific to Django. Is there a Flask equivalent or should I drop the Flask track and start over with Django?

Thank you in advance for pointing me in the right direction :)

2 Answers

Jeff Muday
MOD
Jeff Muday
Treehouse Moderator 28,722 Points

First, I am glad to hear you are ready to take the big step of deploying! It's a huge jump to go from local server to something exposed to the "big wide open" Internet.

Second, there isn't a Treehouse Flask workshop on deployment, but that shouldn't stop you from trying it out! Maybe the good folks at Treehouse will commission me to do a couple of videos about deployment?

I would start with PythonAnywhere. It will allow you to deploy something for free. The site will sleep until it is accessed, but the spin up time is 10-30 seconds. You won't have to worry about setting up a web server just deploy a flask app and start hacking at it.

There are limitations on how much disk you can use. But they do have an associated MySQL database if you need it. You can always upgrade to a paid account if you need more/better service.

I have a demo CMS app running there now--

http://lizardhammer.pythonanywhere.com/

How to get started with PythonAnywhere--

https://help.pythonanywhere.com/pages/Flask/

!!!! Recommended video by Anthony Herbert below-- !!!!

https://www.youtube.com/watch?v=5jbdkOlf4cY

Professionally, I have several Flask apps out "in the wild" and I am deploying at Digital Ocean and Amazon EC2.

The micro instances at these services will set you back about $5/mo. But, If you want to deploy something "free" to experiment with, try PythonAnywhere.

By the way, here is an excellent guide for deploying a Flask app at Digital Ocean. They describe using Nginx as the public facing server, and Gunicorn as the app "runner". It's not the only way to do it, but it gives you a gateway to scaling it and securing it properly.

https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-18-04

Good luck!

Amazing. Thank you so much for your detailed answer, Jeff.

I look forward to checking out the resources you shared. :)