Flask Hello World: Setting up a python virtual environment (venv) in VS Code & installing Flask

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ก.ย. 2024
  • In this video we work in Visual Studio Code that already has the basic Python Extensions. We run python -m venv venv to establish a virtual environment. Next, we made sure the the current user had the appropriate script running permissions in PowerShell (this was a Windows system). Then we activated the virtual environment and ran the command pip install Flask. After that we created a .py file in the virtual environment and added the basic "Hello World" code to have Flask act as a virtual web server and serve up a very simple page. We invoked the flask app from the command line (terminal) and accessed the resulting page.

ความคิดเห็น • 10

  • @user-dg7fu8he9n
    @user-dg7fu8he9n หลายเดือนก่อน

    thank you so much! I have been struggling with this

  • @randyfriend
    @randyfriend 8 หลายเดือนก่อน

    While I know it works, should project files be placed in the virtual environment folder (venv in this case)? Isn't this folder more of a throwaway folder that can be rebuilt at any time (and reload requirements from a requirements.txt file). Putting project files in it seems to clutter what would be part of the distribution files and development files.

  • @BlissAden
    @BlissAden 5 หลายเดือนก่อน

    can you make a video explaining what goes inside the include folder. and also when making .gitignore file what folders and files should someone hide?

  • @carlosrincon8040
    @carlosrincon8040 11 หลายเดือนก่อน

    thank you so much !

  • @rtsplusllc
    @rtsplusllc 4 หลายเดือนก่อน

    Thank you

  • @pruthvichowdary1898
    @pruthvichowdary1898 3 หลายเดือนก่อน

    i am getting error message stating this : Usage: flask run [OPTIONS]
    Try 'flask run --help' for help.

    • @thomasblum9803
      @thomasblum9803  3 หลายเดือนก่อน

      Hard to say. Did everything work up until using "flask run"? Do you have a virtual environment? Is it activated? Did the flask installation work? Is your hello.py file located in the virtual environment? Is your terminal location the same as the virtual environment (venv) location?
      The following link offers some suggestions and alternatives
      www.twilio.com/en-us/blog/how-run-flask-application
      I have seen flask app's started in VS Code by starting with Run and Debug on the left-hand side of Code and then choosing flask from the drop-down and hitting Enter on the keyboard.
      Good luck.

    • @pruthvichowdary1898
      @pruthvichowdary1898 3 หลายเดือนก่อน

      @@thomasblum9803 thanks for the immediate response sir, I just created the fie in Scripts instead of creating it in venv ! great simple tutorial sir. Thank you !

  • @thomasblum9803
    @thomasblum9803  ปีที่แล้ว

    www1.lasalle.edu/~blum/c341wks/Python_Flask_Hello_World.zip

  • @shadysamy-di8yf
    @shadysamy-di8yf ปีที่แล้ว

    thank you