Python Forum
Setting up IDE for Python with VS Code - Installing and using an extension
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting up IDE for Python with VS Code - Installing and using an extension
#1
Hello Python Community

I'm not so new to Python. I went following a tutorial for crud in web app in Python. The issue is I have to install flask. I did, with pip, then I uninstalled it because the IDE couldn't see flask, then I tried to install again and the line:

from flask import Flask

produces an error (it says module is not found). I deleted the \.vscode\extensions folder and installed Python again; I was able to run py from the terminal, but when I tried to run the project appeared a dialogbox saying "There is no Python Debugger, do you want one?", then I installed a Python from Microsoft and then it was like it works the "Start debugging", but I installed flask with pip in the terminal and then I wrote pip list and saw Flask, but the project debugging stopped reporting flask is not found. Maybe the flask installation went to the installation folder of the Python.org download, the first, that wasn´t able to debug the project, actually I found flask files in this folder:
C:\Users\PABLO\AppData\Local\Programs\Python\Python313\Lib\site-packages\flask
I say that AppData folder is hidden, I don't know why.

I think that if I could run the project with my Python installation from official page (not the Microsoft one that VS Code prompt me to install) then it would see the flask installation and the project would run fine.
Would anyone please tell me how? I know this is a very basic question and I said I was a .Net developer and you are going to think I am a complete fool (and you'll be right!), but I always had trouble to set up developng environments.
Or can you tell me if there's a tutorial for setting up the IDE, or something?
Thank you very much in advance.
Pablo
PS: This didn't happen with tkinter
Reply
#2
UPDATE:
I tried a moment ago this:

py main.py

and the output is this:

PS C:\Users\PABLO\Desktop\sisclientes> & C:/Users/PABLO/AppData/Local/Programs/Python/Python313/python.exe c:/Users/PABLO/Desktop/sisclientes/main.py
* Serving Flask app 'main'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 115-385-197
PS C:\Users\PABLO\Desktop\sisclientes> & C:/Users/PABLO/AppData/Local/Programs/Python/Python313/python.exe c:/Users/PABLO/Desktop/sisclientes/main.py
* Serving Flask app 'main'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 115-385-197

Now I don't see the 'flask' word underlined any more and I think I succeded to run the right Python version, but the project doesn't run.
Reply
#3
I paste the http://127.0.0.1:5000 address in the web browser and the project runs properly.
I'm sorry for bothering yourselves with my silly proposal, which I was able to solve.
Just one more doubt, is there a way for opening the web browser with the address (http://127.0.0.1:5000) directly from VS Code?
Thank you very much and sorry!
Regards
Pablo
Reply
#4
usually you can hold alt + left click on the link in the console and the browser will open. May have to click a couple of times.
TheTiger likes this post
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
Download my project scripts


Reply
#5
(Oct-14-2024, 02:50 AM)menator01 Wrote: usually you can hold alt + left click on the link in the console and the browser will open. May have to click a couple of times.

Hello
I have just seen it is Ctrl + left click.
Thank you very much for your kind help
Pablo
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020