Learn to Code via Tutorials on Repl.it!

← Back to all posts
Flask Tutorial How to Set it up!
Epicmuffinepic

Flask - How to set it up

When I wanted to make a website with python I know I wanted to use flask. But I didn't know how to set it up! This tutorial will get you set up for flask!

import flask

You could do this:

Or you could clear all the code (which I wouldn't do if you already have a lot of code) and Click the: examples and click the flask examples:

The stuff on the top is basically setting up a screen for you.
That will put: Hello, World!
In the screen

But we want to connect to HTML

So bascially we have to put in imports:

Ok now we add the following code:

You can name the function(def home) what ever you want but I'm going to name it home because it is, like, the home page.

Next you are going to create a folder named templates. Make sure it is named templates or it won't work. Add a file in the folder called:

Then add anything you want to it! You can make multiple files in the single templates folder.

REMEBER THIS IS ONLY A BASIC TUTORIAL ON HOW TO SET UP! I BET THERE IS A LOT MORE DIFFERENT WAYS TO DO THIS!!

SIDE NOTE: IF IT DOES NOT WORK MAKE SURE YOU HAVE THE LAST LINE:

DOUBLE SIDE NOTE: If it still doesn't work then reload your page.

Voters
EmeraldThunder
AmoghTheCool
wjnb
Epicmuffinepic