In this video, we set up a Linux server from scratch before we deploy Flask, which is what a lot of people have requested. But if you already have a server ready to go then you might not be interested in the setup part. If you'd like to skip the Linux server setup and go straight to the deployment then please skip to 26:48 I hope people find this useful. Deployment can be a tricky topic because there are so many different choices (e.g. hosts, operating systems, web servers, etc). These are my preferred choices in this video. Remember, if you'd like to sign up for $20 of credit at Linode then you can use my link to signup: linode.com/coreyschafer
Hey Corey, I added a text editor to make the blog a bit more functional. You can check out the repo linked below. github.com/gardnmi/flask_blog_editor The first blog post explains how to use. To log in the use admin@admin.com and admin for the password. Thanks for the tutorial!
Hello Corey. I have used your github code, followed your instructions on a 18.04 LTS ubuntu, and when i tried to "run flask" i am getting the error message "Error: Could not import "run"." any idea what it could be?
== TIME STAMPS of CODE and COMMANDS== 29:41 - `pip freeze > requirements.txt` - and move the text into Flask_Blog folder 30:35 - `scp -r Desktop/Flask_Blog coreyms@45.33.123.214:~/` - where we copy Flask_Blog from personal machine to Linode 31:50 - `sudo apt install python3-pip` 32:12 - `sudo apt install python3-venv` 32:44 - `python3 -m venv Flask_Blog/venv` 33:19 - `source venv/bin/activate` - in our Flask_Blog dir we activate our venv 33:50 - `pip install -r requirements.txt` - we install our pip packages into our venv 37:40 - `sudo touch /etc/config.json` & `sudo nano /etc/config.json` - where we now store our environment variables inside a file instead of the system 40:22 - `sudo nano flaskblog/config.py` - *add* the following code `import json` `with open('/etc/config.json') as config_file: config = json.load(config_file)` 41:50 - we are still in config.py and *replace* `os.environ.get` with `config.get` 43:35 - `export FLASK_APP=run.py` - where we assign the environment variable FLASK_APP to the module 43:55 - `flask run --host=0.0.0.0` - we run a local dev server on the linode 48:26 - `sudo apt install nginx` 48:53 - `pip install gunicorn` 50:02 - `sudo rm /etc/nginx/sites-enabled/default` - we remove nginx default config 50:20 - `sudo nano /etc/nginx/sites-enabled/flaskblog` - new nginx config solely for our app. Add the code from Corey's snippets. Remember: gunicorn is running on port 8000, nginx is running on port 80 54:27 - `sudo nano ufw allow http/tcp` & `sudo ufw delete allow 5000` & `sudo ufw enable` 55:00 - `sudo systemctl restart nginx` - restart nginx server 56:25 - access your URL/static/main.css. This proves that nginx server is serving static content and that it cannot serve the dynamic content because Gunicorn is not running yet. 58:02 - `nproc --all` - to find out how many cores on this machine 58:35 - `gunicorn -w 3 run:app` - now that gunicorn is running, we access our main site and this proves that nginx is passing HTTP requests to gunicorn 1:00:23 - `sudo apt install supervisor` - this software (written in python!) will run Gunicorn in the background 1:00:50 - `sudo nano /etc/supervisor/conf.d/flaskblog.conf` - create a supervisor config file referring to flaskblog package, and Gunicorn. Add corey's snippets 1:04:10 - note that we point supervisor to (yet uncreated) log files located: `/var/log/flaskblog/flaskblog.err.log` & `/var/log/flaskblog/flaskblog.out.log` 1:05:03 - `sudo mkdir -p /var/log/flaskblog` 1:05:22 - `sudo touch /var/log/flaskblog/flaskblog.err.log` & `sudo touch /var/log/flaskblog/flaskblog.out.log` - where we now create our log files 1:05:42 - `sudo supervisorctl reload` - where we restart supervisor 1:07:40 - `sudo nano /etc/nginx/nginx.conf` - where we access general config file for nginx 1:07:54 - `client_max_body_size 5M;` - add this code in the config file to increase upload limit from 2MB to 5MB 1:08:30 - `sudo systemctl restart nginx` Your site is now in production! :D
@@coreyms thank you! I made this because I ended up making changes to my package and wanted to remember a) what we added that is not in my personal computer's package and b) all the ubuntu commands (my first time deploying to linux)
thank you soooo much. I was copying all those commands but lost them because of an unexpected reboot. I can not believe you recorded and share them here, thanks again
@@lightninginmyhands4878 bro... actually am using Gmail to send mails but when i am trying to reset password it just keeps on loading & after a few minutes its showing 502 nginc error !! can you please belp me out
How to enable multiple logins in Flask. When I deployed my Flask app in Heroku , only one can login at a time. The app collapses when multiple users tried to login please help me to solve this.
Request: Please create a video on migrating the DB to PostgreSQL. In the initial videos of this series, you mentioned that you will show how to use Postgres. Eagerly waiting for this :D
When I was younger (like 12 or 13) I would often get mad at the person putting the help out into the world when it was really just that I didn't understand something. Some of this is hard for people without a point of reference to wrap their heads around so I'd imagine some of those downvotes are either bots trying to seem like genuine accounts or are people doing that.
Was tasked to get a Flask app up and running on a Linux server. I have never seen Linux before, and thought Gunicorn was something from my daughters fairy tale books. I followed this video step by step and without a hitch, had the site up and running within an hour. What an excellent video, well presented, to the point. Thank you very much.
server config, ngnix configuration, ssh configuration supervisor config all in one place. This is incredible stuff. A very thorough and detailed explanation. Thank you so much for putting the time to create this tutorial. Also if possible please create the video for including SSL certificate, I have been following flask series and this series now have everything for zero till deploying. It would be great not to leave the ssl part too.
for anyone wanting to selfsign ssl and then connect it to a trusted ssl, i have found these two tutorials useful which u must apply both for a result www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-nginx-on-centos-7 ruclips.net/video/PzIgHz5r-h0/видео.html&ab_channel=RANAsVFX
I appreciate your thorough guide and doing everything the right way. So many tutorials skip over every other detail and just show the bare minimum. I like how your video shows all the best practices. Thank you!
Corey, just wanted to say I think you're the best Python teacher out there and I really appreciate all your videos (and I'm supporting via Patreon - although in small amounts - to show my appreciation). Take it easy and come back when you're ready to come back.
I think it's important to make the following distinctions after we switch from using Flask's local dev server to web-facing NGINX/Gunicorn structure: Our Flask app is a *WSGI app* . It generates dynamic content (ex: user posts, user names). The way it can do this is by accessing the database (i.e. using SQLAlchemy). Gunicorn is a *WSGI server* which launches the WSGI app. In this video, Gunicorn is also a manager of 3 workers which each launches one instance of the WSGI app. NGINX is a *web server* which generates static content (ex: navigation bar, page name). This also delivers HTTP requests to Gunicorn.
A great thanks to you Corey, your way of explaining the topics in a simple way make me all the way to learn the flask in a easiest way. Each and every video is crystal clear and easy to follow. Thank again.
I learned something new! 20 years as a sysadmin (OK, mostly Solaris/AIX/RHEL running various IBM, Sun and Oracle enterprise budget-drainware), and I'd never come across supervisor. Awsome!
Just an underrated RUclipsr . Idk how does he even can't get a millions subscribers already , I find his videos so much useful for me 👍🏻.He don't even charge for his videos the least you all can do is atleast subscribe him and support through patreon
There are so many short "to the point videos" out there but I really appreciate what you did Corey, for us new guys it's helpful how you show best practices and all the little details. This is so helpful, especially for those that are not familiar with linux
Thank you so much for the guide Corey! I was able to make multiple web applications myself now. I did end up using pythonanywhere to start with when hosting my applications. However, I recently closed my first client (first time making money developing) and they didn't support a module I was using. This was a life saver, and your guides have been a tremendous help for learning Flask and Python in general! I'll be sure to donate as soon as possible :)
2021 Tip: If you are having problem with NGINX try to open the main config file by nano /etc/nginx/nginx.conf and changei user on top from www-data to you actual username. I had problems because NGINX could not access the static files due to not having permission.
Seriously, your videos are top of the top of the top. I knew all of what you explained here, but I wanted to watch the whole video again to see if there were more tips and enjoying the way you explained. Awesome man. You know what would be nice? Tutorial on prefect, much better than airflow. open source, pythonic, etc. great way for pipelines.
i know im late to the party, but this is as much as you can learn in an hour about a linux backend/deployment. it was usefull to me 4 years later, thanks a lot!
I also successfully deployed a Flask based app with the same tree structure as Flaskblog to Heroku. Corey's video on deploying Django based apps to Heroku is very helpful, but about 20% of the steps in that video need to be adjusted for deploying Flask based apps
Thanks Corey. Been programming for 25+ years, truly great pace, precision, and insight into what is important to the problem. Thanks for this and your many other great tutorials. In case anyone else chooses a different mechanism for getting SECRET_KEY, EMAIL_USER, etc. within the app factory of your __init__.py, I ran into a little bug (one of the very few I have seen in any of Corey's work.) If you call the factory with a different class than "Config", the factory ignores the class you pass and still uses the default for the config_class parameter, namely, "Config." Change the line: from: app.config.from_object(Config) to: app.config.from_object(config_class) Best All. Stay safe.
Just came here to say that I really enjoy your videos. I’m still learning the basics of python and your videos are very compact and easy to understand. Thanks for your great work and the time and effort you put into these videos. They help me and probably many other college students a lot that can’t really effort expensive online courses.
I'm so impressed of the way you teach and explain. Job very well done. Not much I can do to give you something in return, but I liked all your videos, I'm watching all the ads on your videos from beginning to the end (I know you might get some extra points on that) and click the ad links as well. The least I can do. BTW... I think people should not be allowed to register with whatever email address they want but one they can validate it is their own. So I would integrate the email verification right at the registration.
An insanely helpful and simple to follow video . Your way of explaining how to do things and what are all these config files ,etc are for, is straightforward . without this tutorial I wouldn't have succeeded in deploying using nginx . Thanks
I really spun up an application with your help in just one weekend. Your videos are really great Corey. Keep up the good work. I am eagerly waiting for your SSL implementation as my boss wants me to move the application from http to https. I am really having a hard time adding certificates.
@@chesterdorn4439 Every work put in is worth something, I believe. However I don't host anything on rpi4 currently. Personal reasons, programming is not the only thing I do in life...
Thanks! That helped me to get my first flask website started without any hiccup. I wish I had seen this video earlier. Would have saved 1 week of frustration. LOL!
Thank you for making this video... i was looking to host my flask app on linux... you're my time saviour Some of your videos helped me in the past and made me a guy to reach for python questions in my Team. All credit goes to you....! Have become your Patreon :) Thanks Corey for your efforts in delivering such amazing Videos
Man THANK YOU, it is literally 3 am but I set up my first flask website on VPS without big problems, it is really I would say unique))) One more time, thank you for your effort and step-by-step detailed tutorial 😁😊😉 P.S.: Keep it up man, we believe in you)))
I followed along the tutorials and I deployed it to Heroku, if someone needs help - you are more than welcome to ask :) Like this comment so everyone will be able to see!
Hello! how did you deploy it to Heroku? I need to deploy my flask app (not this one) to Heroku, and I'm having trouble with it. Your help is much appreciated.
Awesome video! Wanted to learn how to setup Gunicorn on my VPS to run a flask app and your video explains it perfectly. One improvement suggestion for the NGINX part: You don't really want to delete and replace the _default_ file in _sites-enabled_ . That is just a symlink to the real _default_ file, which sits in _sites_available_ . Though this approach will technically work, it can lead to confusion later on, because you end up with two different _default_ files. Instead just open the _default_ file in _sites-available_ and replace its content in an editor.
For anyone that may not have seen many of Corey's videos, he puts out the absolute clearest and easiest to follow programming tutorials I've ever seen on YT. I'm curious why putting the sensitive data into a etc/config.json file is safe, but putting them back into the config.py isn't? Can someone up to no good gain access to the .py file but not the .json file?
Comprehensive lecture. Really appreciate that you provide explanation for every line. Can you make a short tutorial for using docker along with these components ?
For those getting timeout error when sending reset password request: According to this post, Linode seems to have blocked mailing ports due to spam problem, but you can ask them to unblock them after configuring DNS and rDNS records. www.linode.com/community/questions/19082/i-just-created-my-first-linode-and-i-cant-send-emails-why
with DNS and rDNS configured and Linode response: "Per your request, I've removed the smtp restrictions for port 587 on this Linode", I can't send mail with smtplib.SMTPAuthenticationError: (534, b'5.7.14 5.7.14 Please log in via your web browser and then try again. 5.7.14 Learn more at 5.7.14 support.google.com/mail/answer/78754 t8sm36077509wrq.88 - gsmtp') Is there anything to configure with port 587?. Thank you
Thank you for support, this seems to be default problem now ;) Is there any other solution for automatic mailing to work properly without unlocking these ports?
Hi Corey! Thanks for this wonderful series! Your videos are just amazing! Let me just add a small note for Windows users that are not able to activate the Windows Subsystem for Linux for any other reason. If one installs the Git Bash program they are able to ssh just like in a Linux machine. Everything works the same! So, there is no need to install PuTTY even if you are running Windows 8. Hope this can be useful to someone.
Amazing tutorial! Thank you! Would be great if you could expand in case of multiple servers if you want your site to be available everywhere and how to deal with it efficiently.
YO that really worked ,to be more precise what he meant was , sudo nano /etc/nginx/nginx.conf , when you open tat first line "user www-data " change to "user dexter" since dexter is my linux server name .Then save NOW sudo systemctl restart nginx , and NOW you will no longer have the 409 error and you will see the css file.
Great job. Question at 17:xx you issue a ssh-keygen and overwrite your existing id_rsa file. Won't that now invalidate any other systems that you used that id_rsa file in because you overwrote it, thus locking you outout of other servers? Why would you not use your existing id_rsa file?
@@sathyaprakash777 i cant get it to work atall its deploying i can see that but its not showing up on the site email me at raky100012345@gmail.com and ill send u pictures and more info if you want
ruclips.net/video/n1P8B53CCxs/видео.html&ab_channel=Cairocoders i was using this video as a reference but i get thru all the steps but it gives me an error on heroku
This Video is intresting already => shows how configuring your servers and the connectivity between the two securely as much as permissions work but it needs the ACL ones.... as well as deploying your web application ,, Good job and nice video
How to enable multiple logins in Flask. When I deployed my Flask app in Heroku , only one can login at a time. The app collapses when multiple users tried to login please help me to solve this.
spent an hour debugging why my gunicorn kept failing, went through the logs, browsed lots of SO posts turns out i put in the wrong directory in the .conf file! loving linux though, thanks Corey!
Hi Corey... just watched this series.... what a fantastic job! Kudos! Question....would it be possible to do a video on how this flask app can be containerized for docker deployment ?
I'm running into a litany of complications with Nginx permissions. My site works perfectly on 5000 in dev then starts running into 403 errors once on 8000, and I can't seem to pass the login page. The stderr and stdout files aren't very clear either. This whole tutorial is amazing... but I'm really struggling to walk away from it knowing what Nginx is actually doing, especially after hours of external research to no avail. I think I've become a bit spoiled with your quality of teaching and am struggling to get answers elsewhere. Would love to see a video from you on Nginx permissions, and maybe just server/user permissions in general. Thank you so much, Corey!!!!
Thanks for taking this to the next step, Corey - super helpful! With everything up and running, there doesn't seem to be a seamless way to deploy updates to this server. This issue is that you can scp your entire directory (like we did in the video) to overwrite everything, but that overwrites the venv files. The only thing I can think to do is create those files locally so that they are there when I deploy new code. Am I missing something obvious, or do you have suggestions?
@Corey Schafer, many thanks for the time and effort put into the tutorial, I have a question though. Did you exclude the venv from your local system while moving the file to the linux server and did we have to recreate the venv folder on linux if there is already a working version from the local system
Really wish you would do this same tutorial with a postgres database. SQLite is pretty impractical for any application with intention of actually reaching users and getting the postgres to work on the remote is giving me so much trouble.
For someone who struggling with failed reset email function.... If you've followed this video, then you must be using 'Linode'. In order to use sending email service, you should request to Linode Support Team to allow that port for smtp since 2019.
In this video, we set up a Linux server from scratch before we deploy Flask, which is what a lot of people have requested. But if you already have a server ready to go then you might not be interested in the setup part. If you'd like to skip the Linux server setup and go straight to the deployment then please skip to 26:48
I hope people find this useful. Deployment can be a tricky topic because there are so many different choices (e.g. hosts, operating systems, web servers, etc). These are my preferred choices in this video. Remember, if you'd like to sign up for $20 of credit at Linode then you can use my link to signup: linode.com/coreyschafer
Hi Corey, kindly do a video on Flask Restful. Thank you for your tutorials. You reaally helping alot of aspiring developers especially in Africa.
please do a full-on video series on asynchronous programming in python. Thanks
Hey Corey,
I added a text editor to make the blog a bit more functional. You can check out the repo linked below.
github.com/gardnmi/flask_blog_editor
The first blog post explains how to use. To log in the use admin@admin.com and admin for the password.
Thanks for the tutorial!
Hello Corey. I have used your github code, followed your instructions on a 18.04 LTS ubuntu, and when i tried to "run flask" i am getting the error message "Error: Could not import "run"."
any idea what it could be?
@@derricknjoroge2494 yeah loving this from africa kenya
== TIME STAMPS of CODE and COMMANDS==
29:41 - `pip freeze > requirements.txt` - and move the text into Flask_Blog folder
30:35 - `scp -r Desktop/Flask_Blog coreyms@45.33.123.214:~/` - where we copy Flask_Blog from personal machine to
Linode
31:50 - `sudo apt install python3-pip`
32:12 - `sudo apt install python3-venv`
32:44 - `python3 -m venv Flask_Blog/venv`
33:19 - `source venv/bin/activate` - in our Flask_Blog dir we activate our venv
33:50 - `pip install -r requirements.txt` - we install our pip packages into our venv
37:40 - `sudo touch /etc/config.json` &
`sudo nano /etc/config.json` - where we now store our environment variables inside a file instead of the system
40:22 - `sudo nano flaskblog/config.py` - *add* the following code
`import json`
`with open('/etc/config.json') as config_file:
config = json.load(config_file)`
41:50 - we are still in config.py and *replace* `os.environ.get` with `config.get`
43:35 - `export FLASK_APP=run.py` - where we assign the environment variable FLASK_APP to the module
43:55 - `flask run --host=0.0.0.0` - we run a local dev server on the linode
48:26 - `sudo apt install nginx`
48:53 - `pip install gunicorn`
50:02 - `sudo rm /etc/nginx/sites-enabled/default` - we remove nginx default config
50:20 - `sudo nano /etc/nginx/sites-enabled/flaskblog` - new nginx config solely for our app. Add the code from Corey's snippets. Remember: gunicorn is running on port 8000, nginx is running on port 80
54:27 - `sudo nano ufw allow http/tcp` &
`sudo ufw delete allow 5000` &
`sudo ufw enable`
55:00 - `sudo systemctl restart nginx` - restart nginx server
56:25 - access your URL/static/main.css. This proves that nginx server is serving static content and that it cannot serve the dynamic content because Gunicorn is not running yet.
58:02 - `nproc --all` - to find out how many cores on this machine
58:35 - `gunicorn -w 3 run:app` - now that gunicorn is running, we access our main site and this proves that nginx is passing HTTP requests to gunicorn
1:00:23 - `sudo apt install supervisor` - this software (written in python!) will run Gunicorn in the background
1:00:50 - `sudo nano /etc/supervisor/conf.d/flaskblog.conf` - create a supervisor config file referring to flaskblog package, and Gunicorn. Add corey's snippets
1:04:10 - note that we point supervisor to (yet uncreated) log files located:
`/var/log/flaskblog/flaskblog.err.log` &
`/var/log/flaskblog/flaskblog.out.log`
1:05:03 - `sudo mkdir -p /var/log/flaskblog`
1:05:22 - `sudo touch /var/log/flaskblog/flaskblog.err.log` &
`sudo touch /var/log/flaskblog/flaskblog.out.log` - where we now create our log files
1:05:42 - `sudo supervisorctl reload` - where we restart supervisor
1:07:40 - `sudo nano /etc/nginx/nginx.conf` - where we access general config file for nginx
1:07:54 - `client_max_body_size 5M;` - add this code in the config file to increase upload limit from 2MB to 5MB
1:08:30 - `sudo systemctl restart nginx`
Your site is now in production! :D
Thanks!
@@coreyms thank you! I made this because I ended up making changes to my package and wanted to remember a) what we added that is not in my personal computer's package and b) all the ubuntu commands (my first time deploying to linux)
thank you soooo much. I was copying all those commands but lost them because of an unexpected reboot. I can not believe you recorded and share them here, thanks again
@@lightninginmyhands4878 bro... actually am using Gmail to send mails but when i am trying to reset password it just keeps on loading & after a few minutes its showing 502 nginc error !! can you please belp me out
@@Byomakesh1 Hey, did you find any solution?
2023 and this series is still relevant thank you, Corey.
Almost three years has passed, yet still a very helpful and thorough video! Thank you!
1:10:15 Corey, the best feeling was shutting down that console and still seeing my site online. THANK YOU
How to enable multiple logins in Flask. When I deployed my Flask app in Heroku , only one can login at a time. The app collapses when multiple users tried to login please help me to solve this.
@@naveen3046 are you using flask's internal session? You might wanna use something like JWT for aurhorization and Redis for better session management
@@voodoo6729 Thanx bro, but I solved it by adding threaded= True and session
@@naveen3046
can you provide the tut you used to deploy to heroku ???
and is this video useful for this purpose
Request: Please create a video on migrating the DB to PostgreSQL. In the initial videos of this series, you mentioned that you will show how to use Postgres. Eagerly waiting for this :D
@@emiliolezama9694 medium.com/@dushan14/create-a-web-application-with-python-flask-postgresql-and-deploy-on-heroku-243d548335cc this helped me
Seriously Corey. Still waiting.
I don’t understand why some people put dislike on such Video, very informative very clear video ... I learned a lot ... thanks
When I was younger (like 12 or 13) I would often get mad at the person putting the help out into the world when it was really just that I didn't understand something. Some of this is hard for people without a point of reference to wrap their heads around so I'd imagine some of those downvotes are either bots trying to seem like genuine accounts or are people doing that.
Was tasked to get a Flask app up and running on a Linux server.
I have never seen Linux before, and thought Gunicorn was something from my daughters fairy tale books. I followed this video step by step and without a hitch, had the site up and running within an hour. What an excellent video, well presented, to the point.
Thank you very much.
server config, ngnix configuration, ssh configuration supervisor config all in one place. This is incredible stuff. A very thorough and detailed explanation. Thank you so much for putting the time to create this tutorial. Also if possible please create the video for including SSL certificate, I have been following flask series and this series now have everything for zero till deploying. It would be great not to leave the ssl part too.
for anyone wanting to selfsign ssl and then connect it to a trusted ssl, i have found these two tutorials useful which u must apply both for a result
www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-nginx-on-centos-7
ruclips.net/video/PzIgHz5r-h0/видео.html&ab_channel=RANAsVFX
I appreciate your thorough guide and doing everything the right way. So many tutorials skip over every other detail and just show the bare minimum. I like how your video shows all the best practices. Thank you!
Corey, just wanted to say I think you're the best Python teacher out there and I really appreciate all your videos (and I'm supporting via Patreon - although in small amounts - to show my appreciation). Take it easy and come back when you're ready to come back.
Sadly, I dont think he is. His blog and GitHub accounts have not been active for several years now. I hope I am wrong :(
Corey is worth his weight in gold for this video alone
I think it's important to make the following distinctions after we switch from using Flask's local dev server to web-facing NGINX/Gunicorn structure:
Our Flask app is a *WSGI app* . It generates dynamic content (ex: user posts, user names). The way it can do this is by accessing the database (i.e. using SQLAlchemy).
Gunicorn is a *WSGI server* which launches the WSGI app. In this video, Gunicorn is also a manager of 3 workers which each launches one instance of the WSGI app.
NGINX is a *web server* which generates static content (ex: navigation bar, page name). This also delivers HTTP requests to Gunicorn.
A great thanks to you Corey, your way of explaining the topics in a simple way make me all the way to learn the flask in a easiest way. Each and every video is crystal clear and easy to follow. Thank again.
After many hours searching for how to deploy my project, I find everything I need right here.
Amazing work Corey :D
Thanks Corey... deployed my app on linode....added a custom domain and done ssl with auto renew
All thanks to you ..you are just great🙂
These tutorials are the highest quality. Hope you get more sponsors.
I learned something new! 20 years as a sysadmin (OK, mostly Solaris/AIX/RHEL running various IBM, Sun and Oracle enterprise budget-drainware), and I'd never come across supervisor. Awsome!
Just an underrated RUclipsr . Idk how does he even can't get a millions subscribers already , I find his videos so much useful for me 👍🏻.He don't even charge for his videos the least you all can do is atleast subscribe him and support through patreon
There are so many short "to the point videos" out there but I really appreciate what you did Corey, for us new guys it's helpful how you show best practices and all the little details. This is so helpful, especially for those that are not familiar with linux
Thank you so much for the guide Corey! I was able to make multiple web applications myself now. I did end up using pythonanywhere to start with when hosting my applications. However, I recently closed my first client (first time making money developing) and they didn't support a module I was using. This was a life saver, and your guides have been a tremendous help for learning Flask and Python in general! I'll be sure to donate as soon as possible :)
Glad you were able to make your own apps and congrats on your first paid developer gig!
2021 Tip: If you are having problem with NGINX try to open the main config file by nano /etc/nginx/nginx.conf and changei user on top from www-data to you actual username. I had problems because NGINX could not access the static files due to not having permission.
Dude, you're amazing for figuring this out - I had no idea where to begin. Thank you so much!
Thanks. That was easy fix :) worked in 10.2022
Oh man THANKS, youre amazing, worked in 10.2022
Thank you
THANK YOU!!
Corey "let me clear my screen here" Schafer :D.
You are amazing Corey thanks for the in depth tutorial!
The way he explains everything in such a natural way makes it all seem so trivial! I love it! It all just....works when he explains it.
Your whole video series on this is absolutely amazing! Thank you.
Seriously, your videos are top of the top of the top. I knew all of what you explained here, but I wanted to watch the whole video again to see if there were more tips and enjoying the way you explained. Awesome man.
You know what would be nice? Tutorial on prefect, much better than airflow. open source, pythonic, etc. great way for pipelines.
my god... This video could save me 5 days of misery and desperation when i was deploying my webapp. I wish that I had a material like this back then.
Thank you so much Corey, You are the best Instructor I have seen on RUclips
i know im late to the party, but this is as much as you can learn in an hour about a linux backend/deployment. it was usefull to me 4 years later, thanks a lot!
I can't believe you're providing this high quality content for free! I'm supporting your channel to Patreon and recommend others to do so too!
I also successfully deployed a Flask based app with the same tree structure as Flaskblog to Heroku. Corey's video on deploying Django based apps to Heroku is very helpful, but about 20% of the steps in that video need to be adjusted for deploying Flask based apps
Thnx Chris for the pointer.
dude, this content for free is amazing, really appreciate your effort!
Thanks Corey.
Been programming for 25+ years, truly great pace, precision, and insight into what is important to the problem. Thanks for this and your many other great tutorials.
In case anyone else chooses a different mechanism for getting SECRET_KEY, EMAIL_USER, etc. within the app factory of your __init__.py, I ran into a little bug (one of the very few I have seen in any of Corey's work.)
If you call the factory with a different class than "Config", the factory ignores the class you pass and still uses the default for the config_class parameter, namely, "Config."
Change the line:
from:
app.config.from_object(Config)
to:
app.config.from_object(config_class)
Best All. Stay safe.
Thanks for pointing that out!
Fantastic tutorial l. Every time I thought of a question, it was answered 20 seconds later. Thank you.
doing a cloud engineering final project at the moment and needed a guide for NGINX configurations. i did mine on an EC2 and it works!! tq
Just came here to say that I really enjoy your videos. I’m still learning the basics of python and your videos are very compact and easy to understand. Thanks for your great work and the time and effort you put into these videos. They help me and probably many other college students a lot that can’t really effort expensive online courses.
Great stuff Corey. Really blown away by the clarity and attention to detail.
Biggest Corey, years and still helping 🔥
I'm so impressed of the way you teach and explain. Job very well done. Not much I can do to give you something in return, but I liked all your videos, I'm watching all the ads on your videos from beginning to the end (I know you might get some extra points on that) and click the ad links as well. The least I can do. BTW... I think people should not be allowed to register with whatever email address they want but one they can validate it is their own. So I would integrate the email verification right at the registration.
An insanely helpful and simple to follow video . Your way of explaining how to do things and what are all these config files ,etc are for, is straightforward . without this tutorial I wouldn't have succeeded in deploying using nginx . Thanks
followed the whole series. Really amazing. Wish I could stop you at times to explain but figuring it out myself is when I learn the most!
I really spun up an application with your help in just one weekend. Your videos are really great Corey. Keep up the good work. I am eagerly waiting for your SSL implementation as my boss wants me to move the application from http to https. I am really having a hard time adding certificates.
I was doing this with personal raspbery pi as a hosting server with headless SSH. Learned a ton. Thank You, proud Patron.
Was it worth it with Raspberry?
@@chesterdorn4439 Every work put in is worth something, I believe. However I don't host anything on rpi4 currently. Personal reasons, programming is not the only thing I do in life...
@@yomajo Well, It's obvious. But I wouldn't do it if it is unusable :p That's why I was asking more about performance etc. hopefully.
GREAT WORK!!!! Really! Its the most clear, complete, and well explained video I've seen about deploying flask app on linux server
This video is like the bible. To follow step by step when launching a Flask app! Thanks man!
thank you for this awesome content. you wouldn't believe how many times I came back to this video for reference.
Thanks! That helped me to get my first flask website started without any hiccup. I wish I had seen this video earlier. Would have saved 1 week of frustration. LOL!
Thank you for making this video... i was looking to host my flask app on linux... you're my time saviour
Some of your videos helped me in the past and made me a guy to reach for python questions in my Team.
All credit goes to you....!
Have become your Patreon :)
Thanks Corey for your efforts in delivering such amazing Videos
completed the tutorial series so far .. keep updating us with your knowledge... Thanks
I literally use this tutorial for my current job, thanks a lot, Corey.
Thank you for this tutorial series, i really appreciate it!
I think you should make a video on database migrations next.
Man THANK YOU, it is literally 3 am but I set up my first flask website on VPS without big problems, it is really I would say unique))) One more time, thank you for your effort and step-by-step detailed tutorial 😁😊😉
P.S.: Keep it up man, we believe in you)))
Excellent.. In this single video I get to learn lot of things.. Thanks Corey.. You are the Best..
1 hour worth of GOLD.... Thank You
I followed along the tutorials and I deployed it to Heroku, if someone needs help - you are more than welcome to ask :)
Like this comment so everyone will be able to see!
Hello! how did you deploy it to Heroku? I need to deploy my flask app (not this one) to Heroku, and I'm having trouble with it. Your help is much appreciated.
hey please help me to do so, i am having troubles while doing so.
I'd like to know how you deployed it to Heroku. Please share.
Hello I'd appreciate it if you could help me with the deployment on Heroku.
It would be great if you could share how to deploy this to Heroku! Did you use postgresql?
Corey, excellent tutorial as always. I understood clearly all the steps for deployment
Thank you for this great video! It worked like charm even in 2024! Greeting from Germany!
Really don't know why these 14 people have disliked the video... awesome content sir
Thank you, very helpful.
With the precise steps, I was able to deploy flask api in digital ocean.
Hi Corey, kindly do a video on Flask Restful. Thank you for your tutorials. You reaally helping alot of aspiring developers especially in Africa.
Awesome video! Wanted to learn how to setup Gunicorn on my VPS to run a flask app and your video explains it perfectly.
One improvement suggestion for the NGINX part:
You don't really want to delete and replace the _default_ file in _sites-enabled_ . That is just a symlink to the real _default_ file, which sits in _sites_available_ .
Though this approach will technically work, it can lead to confusion later on, because you end up with two different _default_ files.
Instead just open the _default_ file in _sites-available_ and replace its content in an editor.
This man makes Just Incredible Videos and it's free. Thank you, Corey.
Incredibly detailed and useful video. Thanks Corey
For anyone that may not have seen many of Corey's videos, he puts out the absolute clearest and easiest to follow programming tutorials I've ever seen on YT.
I'm curious why putting the sensitive data into a etc/config.json file is safe, but putting them back into the config.py isn't? Can someone up to no good gain access to the .py file but not the .json file?
Keeping sensitive data apart from distros like the Flask_Blog directory (which may travel from one machine to another) is a good thing.
Thank you very much Corey. You have made my life a lot easier. Thank you
Comprehensive lecture. Really appreciate that you provide explanation for every line. Can you make a short tutorial for using docker along with these components ?
For those getting timeout error when sending reset password request:
According to this post, Linode seems to have blocked mailing ports due to spam problem, but you can ask them to unblock them after configuring DNS and rDNS records.
www.linode.com/community/questions/19082/i-just-created-my-first-linode-and-i-cant-send-emails-why
Thanks, I’m all having trouble getting supervisor working if you know anything about that too lol
with DNS and rDNS configured and Linode response: "Per your request, I've removed the smtp restrictions for port 587 on this Linode",
I can't send mail with smtplib.SMTPAuthenticationError: (534, b'5.7.14
5.7.14 Please log in via your web browser and then try again.
5.7.14 Learn more at
5.7.14 support.google.com/mail/answer/78754 t8sm36077509wrq.88 - gsmtp')
Is there anything to configure with port 587?. Thank you
Thank you for support, this seems to be default problem now ;) Is there any other solution for automatic mailing to work properly without unlocking these ports?
Nice ! Waiting for the deployment using Heroku !
Hi Corey!
Thanks for this wonderful series! Your videos are just amazing!
Let me just add a small note for Windows users that are not able to activate the Windows Subsystem for Linux for any other reason. If one installs the Git Bash program they are able to ssh just like in a Linux machine. Everything works the same! So, there is no need to install PuTTY even if you are running Windows 8.
Hope this can be useful to someone.
ok I have git bash so I can run the same commands, following in this tutorial on it easily, right?
One of the least disliked videos on RUclips. This video is genius!
Dude, I am going to be your fans, what a good tutorial you have made, it’s pretty clearly and helped me solve my problem s
Amazing tutorial! Thank you!
Would be great if you could expand in case of multiple servers if you want your site to be available everywhere and how to deal with it efficiently.
If you are getting a 403 Forbidden error after setting up nginx, try changing the user in /etc/nginx/nginx.conf
change it to what?
@@LiverpoolDon1981 change it to what please?
@@WaldoTheWombat your linux user
YO that really worked ,to be more precise what he meant was , sudo nano /etc/nginx/nginx.conf ,
when you open tat first line "user www-data " change to "user dexter" since dexter is my linux server name .Then save
NOW sudo systemctl restart nginx , and NOW you will no longer have the 409 error and you will see the css file.
OMG I second that, you are a life saver sir. Thank you!!!
Great job. Question at 17:xx you issue a ssh-keygen and overwrite your existing id_rsa file. Won't that now invalidate any other systems that you used that id_rsa file in because you overwrote it, thus locking you outout of other servers? Why would you not use your existing id_rsa file?
After a week of struggle Finally able to deploy it in heroku.such a relief.thank corey for nice tutorial.
Hey do you think you can help me with this, i haven't been getting it to work on heroku atall?
@@kyra2438 sure what is the problem ur facing
@@sathyaprakash777 i cant get it to work atall its deploying i can see that but its not showing up on the site email me at raky100012345@gmail.com and ill send u pictures and more info if you want
ruclips.net/video/n1P8B53CCxs/видео.html&ab_channel=Cairocoders i was using this video as a reference but i get thru all the steps but it gives me an error on heroku
@@kyra2438 the problem I was facing is with secret key I replaced it with some random number instead of is.environ then it got deployed try this
Loved the whole flask series! Thanks a lot. Sir, it would be awesome if you could do tutorials on data structures (Linked lists, stacks and queues).
This Video is intresting already => shows how configuring your servers and the connectivity between the two securely as much as permissions work but it needs the ACL ones.... as well as deploying your web application ,, Good job and nice video
I've registered my website with Linode. Anything Corey recommends I believe must be good solution. Thank you Corey
How to enable multiple logins in Flask. When I deployed my Flask app in Heroku , only one can login at a time. The app collapses when multiple users tried to login please help me to solve this.
Great video, just wondering which tutorial video did you implemented the 'SECTRET_KEY' and SQLALCHEMY_DATABASE_URI'
Thank you for posting this video and the one about SSL been trying to find a video that explains what to do.
This video has helped me soooo much, thank you Corey!
spent an hour debugging why my gunicorn kept failing, went through the logs, browsed lots of SO posts turns out i put in the wrong directory in the .conf file! loving linux though, thanks Corey!
this is what we all needed! 1 hour of pure knowledge absorption. beautiful!
Thanks for this tutorial. Very easy to understand and works perfectly.
Hi Corey... just watched this series.... what a fantastic job! Kudos!
Question....would it be possible to do a video on how this flask app can be containerized for docker deployment ?
Excellent video! Very clear and explained step by step.
please do a video on how to deploy this blog on heroku?
inbox have mine on heroku kelvinwainaina03@gmail.com
@@knightofcode hey i sent you an email my email is mathews2492@gmail.com please can you check :D
I'm running into a litany of complications with Nginx permissions. My site works perfectly on 5000 in dev then starts running into 403 errors once on 8000, and I can't seem to pass the login page. The stderr and stdout files aren't very clear either. This whole tutorial is amazing... but I'm really struggling to walk away from it knowing what Nginx is actually doing, especially after hours of external research to no avail. I think I've become a bit spoiled with your quality of teaching and am struggling to get answers elsewhere. Would love to see a video from you on Nginx permissions, and maybe just server/user permissions in general. Thank you so much, Corey!!!!
This is some incredible content. Thank you Corey!!!
9:33 To avoid typing yes every so often, you can add the '-y' to your command. Like this:
"sudo apt update && sudo apt upgrade -y"
thankyou so much can't forget you , you helped me with my project thanks , i was really frustrated
Literally youtube should disable the dislike button on your channel for real...
there is only one dislike though.
opino lo mismo
@Super7 lol
Aged like fine wine
Perfectly explained, thank you Corey
Thanks for taking this to the next step, Corey - super helpful!
With everything up and running, there doesn't seem to be a seamless way to deploy updates to this server. This issue is that you can scp your entire directory (like we did in the video) to overwrite everything, but that overwrites the venv files. The only thing I can think to do is create those files locally so that they are there when I deploy new code. Am I missing something obvious, or do you have suggestions?
@Corey Schafer, many thanks for the time and effort put into the tutorial, I have a question though. Did you exclude the venv from your local system while moving the file to the linux server and did we have to recreate the venv folder on linux if there is already a working version from the local system
Your videos are great Corey!
Thank you so much for putting the time to create this tutorial, it's really amazing
Really wish you would do this same tutorial with a postgres database. SQLite is pretty impractical for any application with intention of actually reaching users and getting the postgres to work on the remote is giving me so much trouble.
Thank you so much my friend. Incredibly informative and tolerant of new developer knowledge :)
For someone who struggling with failed reset email function....
If you've followed this video, then you must be using 'Linode'.
In order to use sending email service, you should request to Linode Support Team to allow that port for smtp since 2019.
Are you referring to port 587?