Premium Only Content

How to Deploy a Flask App to a Linux Server
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!
https://linode.com/techwithtim
Playlist: https://www.youtube.com/watch?v=mqhxxeeTbu0&list=PLzMcBGfZo4-n4vJJybUVV3Un_NFS5EOgX
Download Links:
https://www.putty.org/
https://winscp.net/eng/download.php
Credits:
https://www.digitalocean.com/community/tutorials/how-to-deploy-a-flask-application-on-an-ubuntu-vps
**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 nano /etc/apache2/sites-available/webApp.conf
CLICK TO DOWNLOAD THE CODE TO PUT IN webApp.conf
https://techwithtim.net/wp-content/uploads/2019/11/code-to-place-in-.conf-file.txt
- sudo a2ensite webApp
- systemctl reload apache2
Step 11: Create .wsgi file
- sudo nano webapp.wsgi
Place the below code in the wsgi file
#!/usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/webApp/")
from webApp import app as application
application.secret_key = 'Add your secret key'
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
https://tech-with-tim.teachable.com/p...
📸 Instagram: https://www.instagram.com/tech_with_tim
🌎 Website https://techwithtim.net
📱 Twitter: https://twitter.com/TechWithTimm
⭐ Discord: https://discord.gg/pr2k55t
📝 LinkedIn: https://www.linkedin.com/in/tim-rusci...
📂 GitHub: https://github.com/techwithtim
🔊 Podcast: https://anchor.fm/tech-with-tim
💵 One-Time Donations: https://www.paypal.com/donate/?token=...
💰 Patreon: https://www.patreon.com/techwithtim
◾◾◾◾◾◾
⚡ 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
-
7:54
Tech With Tim
1 year ago $0.01 earnedThese 7 Coding Skills Give You an UNFAIR Advantage
268 -
LIVE
Glenn Greenwald
1 hour agoGlenn From Moscow: Russia Reacts to Trump; Michael Tracey Debates Ukraine War | SYSTEM UPDATE #413
2,273 watching -
LIVE
Slightly Offensive
1 hour agoGOV. RAMASWAMY? Vivek to import 1 BILLION INDIANS to OHIO | Nightly Offensive
721 watching -
DVR
Wahzdee
5 hours agoSniper Elite Then Extraction Games—No Rage Challenge! 🎮🔥 - Tuesday Solos
33.3K -
2:12:58
Robert Gouveia
4 hours agoSenator's Wife EXPOSED! Special Counsel ATTACKS; AP News BLOWN OUT
46.9K28 -
55:07
LFA TV
1 day agoDefending the Indefensible | TRUMPET DAILY 2.25.25 7PM
16.5K11 -
6:09:26
Barry Cunningham
10 hours agoTRUMP DAILY BRIEFING - WATCH WHITE HOUSE PRESS CONFERENCE LIVE! EXECUTIVE ORDERS AND MORE!
61.6K40 -
1:46:37
Game On!
5 hours ago $2.94 earnedPUMP THE BRAKES! Checking Today's Sports Betting Lines!
29.5K1 -
1:27:21
Redacted News
5 hours agoBREAKING! SOMETHING BIG IS HAPPENING AT THE CIA AND FBI RIGHT NOW, AS KASH PATEL CLEANS HOUSE
159K193 -
1:08:28
In The Litter Box w/ Jewels & Catturd
1 day agoCrenshaw Threatens Tucker | In the Litter Box w/ Jewels & Catturd – Ep. 749 – 2/25/2025
93.9K47