How to Deploy a Flask App to Linux (Apache and WSGI)

preview_player
Показать описание

So you built a sweet Flask app and you're wondering how to push it to production? In this video I walk through deploying a Flask application to a Linux (Ubuntu) and Apache2 web server using the mod_wsgi Apache module.

0:00 - Intro
0:12 - The Flask app we'll be deploying
00:58 - Upload the app files to your server
1:54 - SSH into the server, install virtual environment
3:22 - Create the WSGI config file
5:49 - Create a VirtualHost config file
8:16 - Enable the new VirtualHost config
8:53 - Install the WSGI Apache module
9:54 - How to debug errors if the Flask app won't run
10:39 - Test the app again - success!
10:58 - Final comments, peace out ✌🏻

---------------------------------------------------------------
WEB HOSTING - VIRTUAL PRIVATE SERVER (VPS)

---------------------------------------------------------------
INSTALL APACHE2

---------------------------------------------------------------
MY DESK SETUP GEAR

---------------------------------------------------------------
Intro music produced by Connor Curley
Рекомендации по теме
Комментарии
Автор

👋🏻 Hey! Do you like Python? Web app development? Automation?! Let me know what topics you'd like to see me cover next! 😃

LukePeters
Автор

This was awesome! I just built my very first flask app (actually my first web page) and wanted to try to deploy what I have next week for testing. Even without seeing the file structure of the server, I understood what you were explaining so I'm pretty confident. Thank you!

Quaght
Автор

Great vid. Thanks for including the troubleshoots. This is just what I needed for deploying my first flask app to a container. it’s awesome that it’s running on Apache because that makes the letsencrypt certificate renewals that much easier as well!

Rickety
Автор

I was trying to implement an API on my VPS and you helped me in 11:20 minutes more than any other source of information in 8 days of trying.

fernandofacioreyes
Автор

Thx !!! i've been trying for a long time to deploy my flask app into digitalocean ubuntu server, only after use your config code (10:22) it worked.

TheDeepDwellers
Автор

Thank you. It is ridiculous what we need to do in order to solve such a simple task. Shame that in all those years of internet they never came to a better and simpler solution.

Turjak_art
Автор

Thanks for the great tutorial! I know literally nothing about linux or apache and I still got it to work on my raspberry pi thanks to you

julienweems
Автор

Hello, thank you for this video, you saved me because I couldn't upload a server with my python flaskafter watching your tutorial.

deimos
Автор

Hi Luke that was an outstanding Tutorial!

patricktosolini
Автор

you are like a god to me

i appreciate your hardwork alot🤧🤧
stay posted like these videos💖💖

Andyraathi
Автор

First ever time I thumbs up'd a vid.. outstanding tutorial, very detailed!

bivensrk
Автор

Thank you, this video helped fixing an error in my configuration!

s.b.
Автор

👍The Perfect Tutorial! 👍 I am already comfortable with Apache and virtual domains and just needed a quick run through for hosting Python apps. The only thing that would make it better would be having a guthub repo with your project files. Excellent video, thank you.

enpassant
Автор

The first useful tutorial at all for this usecase! Thy.

Richard_GIS
Автор

Thank you so much, you helped me a lot with your video! :)

vincenta
Автор

Hey luke. Thanks for the video.
How did you chnage your terminal color? The colors looks very pleasing! Are you using iterm and omz? What is the theme? 😅

justshoby
Автор

I have centos 7 os there is no ditectory as var/www for apache but httpd service is enabled. Also there is no site enable command to enable it . Please guide.

vijayyajurvedi
Автор

Hi, using old version of linux mint, but for every step I take something goes wrong... why would this be happening? For instance I get pkg_resources cannot be imported, when I've written "pip install setuptools" 100 times

soolydooly
Автор

Hi, very good tutorial. Everything running fine.
I notice that if i change the home.html the content change only of i refresh apache.
can you provide a solution to that ?

I have already add
WSGIScriptReloading On
on virtual site but it didnt work.

Thanks

XChristosK
Автор

I’m havin this error message: AssertionError: You must use exec(open(this_file).read(), {'__file__': this_file}))

You know what that can be?

davipires