How to Deploy a Flask App to a Linux Server

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024

Комментарии • 199

  • @lucaspham5238
    @lucaspham5238 4 года назад +109

    this is such an underrated channel

  • @wilsongoins6398
    @wilsongoins6398 8 месяцев назад +8

    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"

  • @hexa3389
    @hexa3389 3 года назад +31

    Madman typing sudo while root. True sigma grindset.

  • @JamesFraze
    @JamesFraze 2 года назад +8

    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!

  • @JT-qi4xx
    @JT-qi4xx Год назад +10

    Thanks @Tim. very helpful guide! however cmd: sudo apt-get install libapache2-mod-wsgi python-dev didnt work for me because of python3 I guess. so did cmd: sudo apt-get install libapache2-mod-wsgi-py3 instead and it did work. Thanks. you are the best

  • @johncrockett8308
    @johncrockett8308 4 года назад +8

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

  • @ThilinaWimalapriya
    @ThilinaWimalapriya 4 года назад +6

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

  • @JuanSidberry
    @JuanSidberry 4 года назад +6

    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.

    • @LynxGuy
      @LynxGuy 2 года назад +2

      also he was already logged in as root

  • @terribleturtles
    @terribleturtles 4 года назад +4

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

  • @Max-oj9tp
    @Max-oj9tp 4 года назад +2

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

  • @brendanjensen1721
    @brendanjensen1721 4 года назад +3

    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.

  • @koushik7604
    @koushik7604 3 года назад +2

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

  • @CabalBoone
    @CabalBoone Год назад +1

    That was very pleasurable, thank you.

  • @onedaydev
    @onedaydev 4 года назад +9

    A few tips from a Linux Engineer...
    - You're logged in as root, no need to use sudo (sudo = run as root).
    - Use tab completion when entering paths to avoid typos.
    - Ubuntu is pronounced "oo-boon-too".
    - Apache is pronounced "uh-patch-ee".
    - Set up public key authentication if you want to secure your Linux VM. Once it's working, disable root login with password.

  • @cperzam7700
    @cperzam7700 4 года назад +3

    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!

  • @anshulpatil2808
    @anshulpatil2808 3 года назад

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

  • @matijaziberna1512
    @matijaziberna1512 4 года назад +3

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

  • @Ruben_Mdln
    @Ruben_Mdln 4 года назад +1

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

  • @naweendanushka3358
    @naweendanushka3358 Год назад

    Thanks tim for your video series . It is very helpful

  • @jonashaas4681
    @jonashaas4681 4 года назад +2

    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

  • @potthegreen
    @potthegreen 2 года назад +1

    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!

  • @aidans4953
    @aidans4953 3 года назад +4

    > cannot import name app
    Doesn't work, any tips?

  • @jakemayr1
    @jakemayr1 4 года назад +9

    I'm confused, where did the __init__.py files come from, where did the views folder come from, and is there a setup.py that's needed?

    • @mohammadfallah.rasoulnejad5379
      @mohammadfallah.rasoulnejad5379 4 года назад

      I'm not sure what you're talking about but if you mean the contents of "/var/www/webApp/webApp" folder that's the flask app. this video was about running a flask app on Apache remember? so you need to have an app to run. that's the one.

    • @jakemayr1
      @jakemayr1 4 года назад +5

      @@mohammadfallah.rasoulnejad5379 In his past tutorials he didn't go over the __init__.py or setup.py files, just his main flask file so I was wondering about that part of the setup. This video is a part of a series he did as he mentions at the beginning of the video :)

    • @aviwesiyandiba5426
      @aviwesiyandiba5426 3 года назад

      Did you manage to figure that up? I have the same problem

  • @mohammadfallah.rasoulnejad5379
    @mohammadfallah.rasoulnejad5379 4 года назад

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

  • @tactiletech1111
    @tactiletech1111 3 года назад

    ty tim great content as always

  • @johnbryan1523
    @johnbryan1523 8 месяцев назад

    Wow great series for a noob in the Python. Currently working with Akamai(formerly Linode) as you have referenced in this final great video.
    Why didn't you select the LAMP setup? Any particular reason? I set my stuff up using your recommendations, but a service ticket reply from Akamai asked if I knew they had it.
    Again, appreciate your help!

  • @kamolusmonov6540
    @kamolusmonov6540 4 года назад

    I have been thinking about it over a years :D Now I got ) Thanks

  • @benjaminmcgregor1250
    @benjaminmcgregor1250 4 года назад +3

    In the previous tutorials we had a file named 'main.py' in the root folder with __init__.py blank in the admin folder to make it a package. Where has this init file come from?

  • @mikhailshkaralevich574
    @mikhailshkaralevich574 2 года назад

    Thank you! Your tutorial is great!

  • @mnlevi
    @mnlevi 3 года назад +1

    Thank's Sheldon Cooper.

  • @polarpenguin7596
    @polarpenguin7596 2 года назад

    fantastic tutorial!!

  • @liam1732
    @liam1732 2 года назад +1

    I want to kiss you computer server man, you have helped me greatly, keep up the helpful videos!

    • @TechWithTim
      @TechWithTim  2 года назад

      I’ll take likes instead ;)

  • @xAngryDx
    @xAngryDx 2 года назад

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

  • @learntodeveloper
    @learntodeveloper 4 года назад +6

    this case python base on run 2.7.5
    pls how to run python 3.6 base on

    • @liamcodes
      @liamcodes 4 года назад +2

      in your webapp.wsgi file, change the top line from #!/usr/bin/python to #!/usr/bin/python3 (given that you have python3 installed on your server.

  • @michaels8297
    @michaels8297 4 года назад

    Linode is one of America’s greatest companies IMO

  • @luciaravazzi6925
    @luciaravazzi6925 2 года назад

    Very cool man!!

  • @miguelribeiro1506
    @miguelribeiro1506 4 года назад

    Really helpfull man, thanks!

  • @philippevanschendel4904
    @philippevanschendel4904 4 года назад

    Great tuto !! Thanks

  • @adamk8881
    @adamk8881 3 года назад

    THANK YOU SO MUCH!!!! 🐐

  • @muhammadanique2256
    @muhammadanique2256 4 года назад

    Hi Tim , I was following your flask tutorial , the last video where you host the side , is it valid for Django apps as well or is it limited for only flask apps?

  • @magnesiumfilmsltc1530
    @magnesiumfilmsltc1530 4 года назад +2

    Could you recommend any tutorial for setting up the custom domain?

  • @rmatveev
    @rmatveev Год назад +1

    Actually I did not get why you may need all these Apache sfuff.
    Flask can work as without. Just need to change the default port from 5000 to 80 and take care of all static files in your application (which Apache take care about usually).

    • @jhahn716
      @jhahn716 9 месяцев назад +1

      Because "Do not use the development server when deploying to production. It is intended for use only during local development. It is not designed to be particularly secure, stable, or efficient."

  • @tobiaszgleba5295
    @tobiaszgleba5295 4 года назад +2

    video description:
    step 5:
    err:
    sudo systemctl status apache 2 -> sudo systemctl status apache2

  • @ericfricke4512
    @ericfricke4512 4 года назад

    Awesome! Thanks.

  • @johnbryan1523
    @johnbryan1523 8 месяцев назад

    Thanks!

  • @anirudhpai2774
    @anirudhpai2774 3 года назад

    Thank you so much!

  • @jermeekable
    @jermeekable 4 года назад

    I like what you are doing but id like to know the cli way all the way through. Copy Pasta in gui to get files on ur server is not as useful as knowing how to pull from git for instance. Anyways thanks for the vids, they are helpful.
    I have been digging youtube for weeks for good ubuntu server vids. Good ones are rare. Most I find are one off vids on how to install ubuntu server or terminal basics. I really hope you fill the niche. Ive only found two other playlists that get beyond basics helpful. But this is the only one ive seen touch flask.
    I managed to deploy a flask app to my server with gunicorn but dont know the diff between what I did n using apache. Or how to set up postgres locally on the server and connect to it. I guess I will just read what I need to know when the time comes but would much rather learn about it by watching a dope youtube lecture!!!

  • @l30lxbrg
    @l30lxbrg 3 года назад +1

    TIM UR A REAL G 4 LIFGE

  • @quandoeuforrico
    @quandoeuforrico 4 года назад

    00:00
    Hello people. (lol)
    I don't know what Linux is, but I'll watch this video!
    Thank you!

  • @jhoanmartinezsilva2609
    @jhoanmartinezsilva2609 4 года назад +4

    Please a crud tutorial in Django ✌️

  • @yeer32
    @yeer32 3 года назад +6

    For anyone else getting the error:
    E: Unable to locate package python-pip
    -
    try doing:
    sudo apt-get install python3-pip

  • @mattbarletta8100
    @mattbarletta8100 2 года назад +1

    anyone else getting a 500 Internal Service Error?

  • @andreig3370
    @andreig3370 4 года назад

    Hi Tim!
    Thanks for that video, that was very helpful, but I have one question. Must I create a folder called 'static' or not? If yes, what should I put inside of it? I have my Flask app, but I have only a 'template' folder and this is enough for me. Is it correct or should I reconfigure it somehow?
    Thanks for your help!

    • @ryperson269
      @ryperson269 Год назад

      static is for stuff like css and images

  • @udaysankarg8269
    @udaysankarg8269 3 года назад

    Tim, Can you also tell us how to deploy using docker containers - Flask app + DB and deploy on Cloud if possible

  • @abeilcoelho8625
    @abeilcoelho8625 3 года назад +1

    What if we need to run more than one app on a server and/or on different ports? Thanks!

  • @samuelepignone8255
    @samuelepignone8255 4 года назад +1

    PLEASE HELP ME!!!
    I follow all the steps but at the end I see the apache2 page and not my flask application

    • @evertonsilva2631
      @evertonsilva2631 4 года назад

      sudo a2dissite 000-default.conf
      to disable the default configuration for apache

  • @intrinsic524
    @intrinsic524 2 года назад +1

    i think linode changed. apache error says "no module named flask" which is a python2 error

  • @pradeeptabhattacharya9657
    @pradeeptabhattacharya9657 4 года назад

    Please make a video on flask-sijax. I actually understand your tutorial and I am having a problem with understanding sijax.

  • @narekzamanyan893
    @narekzamanyan893 2 года назад

    Thank you!!!

  • @koheisuzuki6355
    @koheisuzuki6355 4 года назад

    Can you create a short video or a blog post about how to deploy with a virtualenv on apache with concreate examples?

  • @gresliebear
    @gresliebear 4 года назад +2

    how do you change ip address to domain name?

  • @SkyFly19853
    @SkyFly19853 4 года назад +1

    That's very very nice since I am a Linux user...

  • @dolodestinations7628
    @dolodestinations7628 6 месяцев назад

    Tim,
    Do you have any videos on how to configure a linode server? I added the certificate from letsencrypt and browser works great, but mobile is being blocked. It has something to do with the IPV4 vs IPV6 connection. IPV6 is being blocked. Letsencrypt only has forums, and no one is giving an answer. Please help!
    Thank you,

  • @stefanherbek2025
    @stefanherbek2025 3 года назад

    Hi, great video. Thank you very much! Does this also work for Dash (Plotly Dash) Apps? Dash is based on Flask.

  • @norabonifas9642
    @norabonifas9642 4 года назад +2

    I have been getting an Internal Server Error... the page instructs me to find more information about the error in the server error log, but I'm not sure how to access it so that I can see what needs to be fixed. Anybody have any tips?

  • @jmsolorzano13
    @jmsolorzano13 3 года назад

    Great video... If I have a flask rest api, Can I use the same deploy process?

  • @gabalawy5
    @gabalawy5 4 года назад

    big thanks for you..

  • @ririraman7
    @ririraman7 2 года назад

    Thank you.

  • @thomassmith9487
    @thomassmith9487 3 года назад

    Why do you use Putty instead of just sshing in through command prompt?

  • @bikeanime5126
    @bikeanime5126 3 года назад

    I had hosted my site using this Apache but I am getting Hello World program instead of my actual web site ... Could you help me ?

  • @kukhokuhletsengwa5730
    @kukhokuhletsengwa5730 4 года назад +1

    Hi Tim. I have followed your video. However, I only see "Index of/ Name Last Modified Size Description" when I visit my IP Address in the browser. It is as though I do not have an html file, yet I know I have one. Please assist. Thanks for the awesome video.

    • @CavanMitchell
      @CavanMitchell 2 года назад

      did you figure this out? I have the same issue.

  • @foreverkatiexx3
    @foreverkatiexx3 4 года назад +1

    I keep getting this error: "No supporting authentication methods available (server sent: publickey)" . Any ideas on why I'm getting this and how to fix it?

  • @tobiapioscivoletto3686
    @tobiapioscivoletto3686 2 года назад

    Hi Tech, my script give me problem with Flask Session. The server response with a PermissionError: Permission Denied "/flask_session". I've tried all but nothing

  • @user-cd7hz8mt7c
    @user-cd7hz8mt7c 3 года назад

    sudo is not necessary if you work under superuser, isn't?

  • @bekhruzniyazov6600
    @bekhruzniyazov6600 4 года назад +1

    It's a lot better and easier to do it with Heroku but anyway a very good video like always

  • @bbuehl792
    @bbuehl792 4 года назад

    If you want to run from a virtual environment add to top of webapp.wsgi (from wsgi docs):
    import os
    import sys
    import logging
    # ensure venv is in same dir as 'webapp.wsgi'
    activate_this = os.path.dirname(__file__) + '/venv/bin/activate_this.py'
    with open(activate_this, 'r') as f:
    data = f.read()
    exec(data, {'__file__': activate_this})

  • @benjaminzwier342
    @benjaminzwier342 2 месяца назад

    so is anyone else not able to get the page to show html files from the template folder? it is running from the thml folder in the first webApp folder, even though i did everything exaclty the same as tim.

  • @dawnbugay2288
    @dawnbugay2288 4 года назад

    Is this get all dependencies of your app?

  • @AzlanCoding
    @AzlanCoding Год назад

    Hi, thanks for your video. It really helped me set it up in my 1st generation iPad air. However, I would like to set up openssh's SFTP. How can I do this?

  • @eolnuha
    @eolnuha 3 года назад

    why when I try to write my sqlite3 database it says "attempt to write a readonly database"?

  • @leonvanzyl
    @leonvanzyl 3 года назад +1

    I'm unfortunately getting an Internal Server Error when deploying to an Ubuntu server on AWS (EC2).
    Great tutorial either way, keep it up!

    • @jannis7340
      @jannis7340 3 года назад

      I also got this error on an RaspberryPi 3 b...

  • @Gamerimkarton
    @Gamerimkarton 3 года назад

    I have an homeserver but just have the local IP, how can i get the right Ip ? because it wont work with the local ip

  • @weaselwords3386
    @weaselwords3386 2 года назад

    Great tutorial - I ran into an issue on the winSCP part of moving files to the directory.
    Reason : lack of privileges and needing root.
    winSCP can inject a shell command at the point of connection under the Advanced setting within the session configuration.
    click Advanced then under the Environment > SCP/Shell option add the command to the shell: field in this case 'sudo su -'
    (this elevates the user id to root privileges at point of connection.)

    • @braydenuber3603
      @braydenuber3603 2 года назад +1

      i cant get the sql data base to work when its deployed it works on host but not on the server

    • @muhie
      @muhie 2 года назад

      @@braydenuber3603 yes i can read the database but not write to it, do you have the same issue/do you have a fix

    • @WireNut88
      @WireNut88 2 года назад +1

      @@muhie You have to go into WinSCP on the files u need to write in, click on them individual once, then look for the properties option near the top right(not all the way top right). After you hit that in the permissions section, make sure all the W boxes are check marked. This files leading to that file have to have the permission to write as well(webApp file if that’s what u called it).

    • @muhie
      @muhie 2 года назад

      @@WireNut88 do you have to modify any of the wsgi file

    • @muhie
      @muhie 2 года назад

      @@WireNut88it works now thank you!!!!!

  • @dawnbugay7094
    @dawnbugay7094 4 года назад

    is this will work in machine learning to deploy it like this?

  • @SpooningTreesap86
    @SpooningTreesap86 3 года назад

    Does anybody know if this will work if I deploy my flask app (which is a simple REST API to handle incoming POST requests only) using this method but then reference the server IP from my front end which is on a separate server?
    Meaning I have a single page html/JS page which enables an AJAX post request that successfully is handled by flask on a separate server? In practice I have it working putting my flask app on loaclhost port 5000 and my front end on port 5500. The only part that concerns me is how the templates folder is required, yet I won't be displaying any html from this server.

  • @_b0mbix_
    @_b0mbix_ 4 года назад

    Can I do everything same on own Ubuntu when I've static IP?

  • @aplombsunny
    @aplombsunny 4 года назад

    How to handle multithreading in flask app on production server?

  • @prawnydagrate
    @prawnydagrate 4 года назад

    Now I've fixed it, but Flask SQLAlchemy fails to open my database file because it doesn't have permission.
    Does anyone know what I am supposed to do?

  • @fvgoya
    @fvgoya 4 года назад

    So, if we use Flask (Python), we will always need to have APACHE (which is manly to run PHP) to run Flask? Does not exist a server for Python, like Apache for PHP or Node for JavaScript??

    • @Asmayra
      @Asmayra 4 года назад +2

      The more common approach would be to use gunicorn as a webserver and nginx as a reverse proxy. Miguel Grinberg has a good guide on this in his Flask Mega Tutorial (Chapter 17).

  • @saadkhan-ku8bl
    @saadkhan-ku8bl 2 года назад

    very nice

  • @sospam3417
    @sospam3417 4 года назад +7

    Hey Tim, generally i enjoy your content but this is very dangerous since it seems you have not a lot of experience using Linux. Especially since this is targeted towards people setting up their first web server with most likely bad/insecure websites.
    -You are not showing how to properly set up the firewall (e.g. disallow all incoming connections besides ssh/http/https)
    -You are doing everything as the root user. This is a HUGE nono on Linux.
    I understand you want to help people get their stuff up and running but when we put resources out in the WWW we should at least have a minimum in terms of security.

    • @TechWithTim
      @TechWithTim  4 года назад +6

      Thanks for pointing that out! You are correct I do not use Linux frequently. The security is definitely an issue and the objective of this is to show people how to get very basic Hobby websites up that they can mess with themselves. I did not mean to imply that this would be ok to do for proper websites. I appreciate the feedback and will be more careful in the future!!

    • @SlavikMindstorm
      @SlavikMindstorm 4 года назад

      can you tell me where I can find tutorials to do that?

  • @yassermunoz1984
    @yassermunoz1984 3 года назад

    ya lo tengo desplegado pero no me muestra la pagina cuando me redirecciona\

  • @ta9995
    @ta9995 3 года назад

    error
    Not Found
    The requested URL was not found on this server.

  • @scoa_dev8551
    @scoa_dev8551 4 года назад +2

    I really dislike how this guy tends to name multiple different files and folders the same name! How about webApp_server and webApp_root. That would be so much better and way less confusing. Then same was when he named the blueprints on another flask vid he has.

  • @miss_tech
    @miss_tech 2 года назад +1

    i did the exact same steps until the end i got a 500 error

  • @jadhavsuyu
    @jadhavsuyu 4 года назад

    Hello sir, can you teach us
    how to build API using neo4j...

  • @ramakiran3
    @ramakiran3 3 года назад

    Hi... Please tell me, how to do deploy flask web application in windows IIS... please help me on this... You help is highly appreciated 🙏😊❤

  • @user-bc2ec6dg4e
    @user-bc2ec6dg4e 4 года назад

    Now how can I see that website you made?

  • @WaldoTheWombat
    @WaldoTheWombat 3 года назад

    When typing the command:
    sudo apt-get install libapache2-mod-wsgi python-dev
    I get the following message:
    "Note, selecting 'python-dev-is-python2' instead of 'python-dev'
    Package libapache2-mod-wsgi is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source"
    Does it need to be:
    apt-get install libapache2-mod-wsgi-py3
    ?

    • @thomaseardley2900
      @thomaseardley2900 3 года назад

      did you find out the answer to this because i have this problem to ?

    • @WaldoTheWombat
      @WaldoTheWombat 3 года назад +2

      @@thomaseardley2900 i think I eventually put in the command i wrote below and it worked

  • @primaireernovembre
    @primaireernovembre Год назад

    hello...can you give me a video to how i can change the ip to my domain name !!