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!

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 Using Databases in Python Our Diary App What We're Going To Do

What do you mean by 'something I can use from Flask'?

So, if I create an command line application I can integrate it to a web site? I am new to python and back-end development and I don't know where to start doing things.

Given some backend setup, yes you can. There are two later courses in Python: Flask Basics and Bulding a Social Network with Flask, that use Python and the Flask framework to integrate our command line work into a web app.

Nice! I have a couple of console application that might be good to have it in a web app.

2 Answers

Ricky Catron
Ricky Catron
13,023 Points

It is very easy to turn a command line application into a website in Python. The tricky part is separating the logic from the display. By this I mean you won't be printing anymore you would be instead sending the variable to the webpage so HOW you are displaying it will change but the logic will not. You will likely be able to keep most of your functions the same but you will likely need to make some changes in the display.

Goodluck! --Ricky

Alx Ki
.a{fill-rule:evenodd;}techdegree seal-36
Alx Ki
Python Web Development Techdegree Graduate 14,822 Points

Just adds if name == 'main' in case if we will import this file to anywhere for using functions and database. If we import it without that block it will 'execute'.

alexey kislitsin i have a query that if i import this file like "from diary.py import * " does it means it will execute automatically if i don't use the " if name = "__main" ", so can you tell me what is value of name in case when i import it in other file