How to Deploy a Flask App to a Linux Server

preview_player
Показать описание
This video will show you how to deploy your flask app to a headless linux server that is running ubuntu. We will be using apache and wsgi to do so.

Thanks to Linode for sponsoring this video! Deploy your linux server by clicking the link or using the promo code TWT19 for $20 free credit!

Download Links:

Credits:

**Procedure (refer to video for missing details)**

Step 1: Setup a server on linode

Step 2: Download Putty and SSH in

Step 3: Download and Install Apache
- sudo apt update
- sudo apt install apache2
- apache2 -version

Step 4: Configure Firewall
- sudo ufw app list
- sudo ufw allow ‘Apache’

Step 5: Configure apache
- sudo systemctl status apache 2

Step 6: Install and enable mod_wsgi
- sudo apt-get install libapache2-mod-wsgi python-dev

Step 7: Creating flask app
- cd /var/www
- sudo mkdir webApp
- cd webApp

Step 8: Install flask
- sudo apt-get install python-pip
- sudo pip install Flask
- sudo pip install flask_sqlalchemy

Step 9: Use winSCP to transfer python files to server

Step 10: configure and enable virtual host

- sudo a2ensite webApp
- systemctl reload apache2

Step 11: Create .wsgi file
Place the below code in the wsgi file

#!/usr/bin/python
import sys
import logging

from webApp import app as application

Step 12: Restart apache
- sudo service apache2 restart

Step 13: Visit the ip address of your server in the browser to access your website!

◾◾◾◾◾
💻 Enroll in The Fundamentals of Programming w/ Python

◾◾◾◾◾◾

⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡

Tags:
- Tech With Tim
- How to deploy a flask app to linux
- Deploy flask app
- Flask App Deploy
- Deploy flask app to ubuntu server

#Python #Flask #Linux
Рекомендации по теме
Комментарии
Автор

Madman typing sudo while root. True sigma grindset.

hexa
Автор

THIS was SO helpful. Thanks you! I have come back and referenced it, like, a hundred times!

johncrockett
Автор

The best simple and powerful tutorial I found yet for deploying flask in ubuntu. Thank you very much for sharing this.

ThilinaWimalapriya
Автор

Tim, you're doing a great job! There is a lot of valuable/helpful content on this channel. Keep it up.
Hint: -y when using apt-get install. But this is for experienced users who know they want to say YES to the prompt.

JuanSidberry
Автор

I've followed the series in this and learned quite a bit about flask. Just a quick note that if you are "root" you don't need to type sudo. A security tutorial would be great because there are many things that can be improved on this section. Otherwise, great work, great explanations!

JamesFraze
Автор

Thnx Tim, these videos really helped me understand the setup of a Ubuntu server!

Max-ojtp
Автор

This is the best Flask tutorial available on youtube.
Thanks Tim!!

anshulpatil
Автор

Hi Tim,

I'm so glad I came across with your channel I was looking for this for a couple of days with barely any success.

Thank you very much you have my like!

cperzam
Автор

Thank you, man! After going through sh**tton of articles, I made it to work with your video!

matijaziberna
Автор

very detailed explain by example! specially the details about the mistakes that we might get ourselves into.

mohammadfallah.rasoulnejad
Автор

I can't wait to see what you've got for us next!

terribleturtles
Автор

This series is great. One comment, at around 16:00, you mention that for nano the exit command for Macs can be Ctrl+X or Cmd+X, which isn't correct. You have to use Ctrl+X. Same with all nano commands, need to use Ctrl. I've learned a lot from your series! Keep it up.

brendanjensen
Автор

Thanks tim for your video series . It is very helpful

naweendanushka
Автор

Amazing playlist, thank you Tim. I hope to see the update version - Or comments about what has changed. Thank you very much.

Dani-crcj
Автор

That was very pleasurable, thank you.

CabalBoone
Автор

Great stuff 👍, you just saved me bro for office project deployment

koushik
Автор

thanks Tim, I have a secure apache home server and I've been struggling to get my django and flask apps running online. I will give it a shot with your configs!

potthegreen
Автор

thanks for the tuto men !
you're better than most of my teatchers haha

BenoX
Автор

Following this tutorial in December of 2023 - The command at 8:30 did not work for me on Windowsx86 64bit. This command worked instead "sudo apt-get install libapache2-mod-wsgi-py3 python-dev-is-python3"

wilsongoins
Автор

In case you are facing the issue that the "Apache2 Debian Default Page" displays do:
sudo a2dissite 000-default.conf
to disable the default configuration for apache

jonashaas