Deploy Your Flask App with Vercel: A Step-by-Step Guide

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024
  • Description
    Ready to take your Flask project live? In this step-by-step tutorial, I'll guide you through deploying your Flask application seamlessly using Vercel's free platform. We'll cover everything from setting up your project locally to pushing it live for the world to see!
    What you'll learn:
    Project structure for optimal Vercel deployment
    Creating a GitHub repository
    Connecting Vercel to GitHub
    Configuring your 'vercel.json' file
    Troubleshooting and going live!
    Keywords: Flask, Vercel, deployment, Python web development, web hosting, GitHub, tutorial, beginner-friendly, step-by-step, coding.
    Important Links
    Source Code: github.com/Cod...
    Learn more about Vercel: vercel.com
    Connect with me on GitHub: github.com/Cod...
    #python #pythonprogramming #pythontutorial #coding #webdevelopment #technology #tech #programmer #flask #pythonflask #webdevelopment #deployment #devops #webhosting #clouddeployment #learntocode2024 #codingtutorial #100daysofcode
  • НаукаНаука

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

  • @codingcraft
    @codingcraft  5 месяцев назад +1

    By reviewing there are many people who is getting error in the above steps. Kindly check the the Node.js version in your project setting, it should be "18.x".

  • @lgf-sq9yf
    @lgf-sq9yf Месяц назад +2

    This is by far the best tutorial I'd found about regarding to deploying Flask with Vercel, no blogs actually goes that straight forward. I'm going to write a Medium post about this and will credit you for this. Thanks once again!

  • @arunkumaranp5626
    @arunkumaranp5626 4 месяца назад +4

    Unable to find any supported Python versions. (i got this error)

    • @kairavb
      @kairavb 4 месяца назад +2

      create a package.json file and add the following:
      {
      "engines": {"node": "18.x"}
      }

    • @codingcraft
      @codingcraft  4 месяца назад

      Check your Project Settings and check the version of node, if it is not 18.x then choose the 18.x from dropdown.

  • @piotrfszawadzkki5355
    @piotrfszawadzkki5355 14 дней назад +1

    can i host application with flask and for example React on the front. I tried it by myself once and did not handle this

    • @codingcraft
      @codingcraft  13 дней назад

      Yeah it's possible. For frontend you go with React and backend go with Flask. You just need to configure your main app.jsx file in vercel.json so it renders the frontend.

    • @khushi_xoxo
      @khushi_xoxo 13 дней назад

      Can you please tell in detail what exactly to do? @codingcraft

    • @codingcraft
      @codingcraft  13 дней назад

      Sure in the upcoming video you will get to know the detailed steps of how to do so. Stay in touch.

  • @anuragkhugshal7792
    @anuragkhugshal7792 4 месяца назад +1

    How to fix this Error: Command failed: pip3.9 install --disable-pip-version-check --target . --upgrade -r /vercel/path0/Flask/requirements.txt
    I already have node 18.x

  • @_k_lu7543
    @_k_lu7543 4 месяца назад +1

    Why I update the vercel.json in GitHub then "Deployments" page in Vercel didn't refresh after 5 times?

    • @codingcraft
      @codingcraft  4 месяца назад

      Can you specify what changes you made in vercel.json file.

  • @tecnom7133
    @tecnom7133 10 дней назад

    Thanks

  • @thunderstorm1584
    @thunderstorm1584 23 дня назад

    i followed everything works except when installing into vercel, my css and javascript did not work. It seemed like vercel cannot find my static files in static which has the css and ja files

    • @codingcraft
      @codingcraft  23 дня назад

      Check your path in index.html file same as mine, and it should work fine. Also check the folder structure.

  • @user-hh4kw7cw7b
    @user-hh4kw7cw7b 4 месяца назад +1

    perfectly working , great work

  • @Meltdown_Gaming
    @Meltdown_Gaming Месяц назад

    Thank you for this, helped a lot.

  • @imammihir
    @imammihir 4 месяца назад +1

    what if i have multiple python file ? like anything i need to do with vercel.json if i have morethan 1 python file?

    • @codingcraft
      @codingcraft  4 месяца назад

      But your all main code will be in 1 file, you can import all the rest files in that one file. In our case 'app.py' contains main code, If I have multiple files I will import all that files in my 'app.py' file.

  • @petersudai3165
    @petersudai3165 3 месяца назад

    i'm trying to deploy an app with a backend and remote database and it only loads the landing page. when I try to login it says "Internal Server Error
    The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application."

    • @petersudai3165
      @petersudai3165 3 месяца назад

      the app however works perfectly locally

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

      Maybe its not working because of the database, as only few databases are supported by vercel such as PostgreSQl, Redis etc. If you use any other databases that are not supported by Vercel, it gives internl error. As it can perfectly works fine on local server but cannot on live deployment.

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

    Background animation looks dapperm y drilla. looking good and that

  • @reviewanddestroy8757
    @reviewanddestroy8757 5 месяцев назад +1

    broh when i try clone and to deploy your code locally i got this error Error: Unable to find any supported Python versions. please replay

    • @thatkid-memeandedit2341
      @thatkid-memeandedit2341 5 месяцев назад +4

      I had the same issue today.
      Solution:
      Go to the settings of your current project -> scroll down -> change the nodejs version from "20.x" to "18.x"

    • @luke-mn
      @luke-mn 5 месяцев назад +1

      @@thatkid-memeandedit2341 Thanks!! Not All Heroes Wear Capes

    • @codingcraft
      @codingcraft  5 месяцев назад +1

      Right😊

    • @yashaswikulshreshtha1588
      @yashaswikulshreshtha1588 5 месяцев назад +1

      just add package.json file with just this {
      "engines": {
      "node": "18.x"
      }
      }
      and it should just work

    • @codingcraft
      @codingcraft  5 месяцев назад

      This file can't be added in flask structure because this 18.x version can be done with vercel deploy settings. I have checked the following error, and it's occurring due to vercel settings change.

  • @krupasancheti
    @krupasancheti 5 месяцев назад

    When selecting the 18.x version from settings it is taking a lot of time to deploy the flask app on it. I don't know whether it will be deployed properly or not it is continuously running.
    Any solution for this

    • @codingcraft
      @codingcraft  4 месяца назад

      It will take time but no longer than 3-4 minutes. And for my case I haven't touched any advance settings while deploying the app.

    • @biancamaxino
      @biancamaxino 4 месяца назад

      @@codingcraft where can i see that 18.x version? settings on vs code?

  • @mhmm666
    @mhmm666 4 месяца назад +1

    is it necessary to work in a virtual enviornment?

    • @codingcraft
      @codingcraft  4 месяца назад

      Yes, It is best practice if you are working on large or medium scale projects.

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

    i hope am not too late to ask but i wanna know how does vercell know the file to run?

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

      Because of the vercel.json file.

    • @iosule3719
      @iosule3719 2 месяца назад +1

      @@codingcraft damn u still active? ♥️🔥

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

      Yes bro, I'm active all the time.

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

      @@codingcraft hello bro, i did everything in the tutorial then i go to The production deployment page and im seeing 'No product deployment, push to the main branch' im new to GitHub and all that what does it mean? 🙏

  • @pdavek580
    @pdavek580 4 месяца назад

    ah man thank you so much!!

  • @oamarkanji3153
    @oamarkanji3153 4 месяца назад

    Does this deploy the api endpoints to serverless functions? Or is the app deployed as a long running process?

    • @codingcraft
      @codingcraft  4 месяца назад

      I haven't tried for api endpoints yet. It's for static websites or apps.

    • @biancamaxino
      @biancamaxino 4 месяца назад

      @@codingcraft how to fix
      Failed to run "pip3.12 install --disable-pip-version-check --target . --upgrade -r /vercel/path0/requirements.txt"
      Error: Command failed: pip3.12 install --disable-pip-version-check --target . --upgrade -r /vercel/path0/requirements.txt
      ERROR: Ignored the following versions that require a different python version: 1.21.2 Requires-Python >=3.7,=3.7,=3.7,=3.7,=3.7,

    • @mohamedyacinefedlallah2525
      @mohamedyacinefedlallah2525 3 месяца назад

      no, i just tried it.

    • @codingcraft
      @codingcraft  3 месяца назад

      Update your requirements.txt file

  • @wilder152
    @wilder152 3 месяца назад +1

    I LOVE U BRO

  • @alannagabrielly
    @alannagabrielly 4 месяца назад

    PERFECTTTT

  • @ojochegbe_
    @ojochegbe_ 4 месяца назад

    Ty❤

  • @navaneethr7579
    @navaneethr7579 3 месяца назад

    This Serverless Function has crashed.
    Your connection is working correctly.
    Vercel is working correctly.
    500: INTERNAL_SERVER_ERROR
    Code: FUNCTION_INVOCATION_FAILED
    ID: bom1::jphql-1717149458069-0dea0d36ef33
    What should i do?

    • @codingcraft
      @codingcraft  3 месяца назад

      This error indicates there might be an error in your flask code, try to update requirements.txt file after every module installation.

    • @CSEAhamedBasith
      @CSEAhamedBasith Месяц назад

      bro same problem what u did for solving this error

    • @codingcraft
      @codingcraft  Месяц назад

      Provide me the error and also tell are you using any database with it?.