Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Is there a tutorial for running flask apps locally on windows?

I was able to import flask into IDLE in a virtual environment but cannot get the simple_app.py from the flask basics course to run, and have no idea how I would see it in the browser. I've tried looking online but can't find anything, if someone could explain or point me in the right direction I would greatly appreciate it!

My code from the first part of the Flask Basics course:

from flask import Flask

app = Flask(name)

@app.route('/') @app.route('/<name>') def index(name="Treehouse"): return "Hello from {}!".format(name)

@app.route('/add/<int:num1>/<int:num2>') @app.route('/add/<int:num1>/<float:num2>') @app.route('/add/<float:num1>/<int:num2>') @app.route('/add/<float:num1>/<float:num2>') def add(num1, num2): return '{} + {} = {}'.format(num1, num2, num1+num2)

app.run(debug=True, port=8000, host='0.0.0.0')

1 Answer

HIDAYATULLAH ARGHANDABI
HIDAYATULLAH ARGHANDABI
21,058 Points

You can use visual studio code. It is an open source Microsoft text editor. It has python support and intelisence. It will make your project more efficient you can also use other text editor such as atom, Pycharm and etc.

Thanks! I actually found this tutorial from Microsoft that helped a lot as well

https://docs.microsoft.com/en-us/visualstudio/python/learn-flask-visual-studio-step-01-project-solution?view=vs-2017