Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Using Databases in Python Our Diary App What We're Going To Do

Daniel Santos
Daniel Santos
34,969 Points

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.

Daniel Santos
Daniel Santos
34,969 Points

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
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alx Ki
Python Web Development Techdegree Graduate 14,810 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