Learn to Code via Tutorials on Repl.it!

← Back to all posts
Python Flask
matthewproskils (473)

Basic Flask WHY FLASK Link
Flask is a app server using python. To get started, there are a few modules you should import:

from flask import Flask
from flask import send_file

The first one will allow us to use flask, and the next one will allow us to send files
Now, we have to define our app.

app = Flask('app')

Now, a port(link here) has to be added with

app.run(host='', port=8080)

Now, we have to send the files with

def main():
  return ('hello world')

If you have followed correctly, you should have a pretty basic hello world send. Now, we need to start sending files.
change the

return ('hello world')


return render_template('index.html')

Now, we need to create an html file named 'index.html'.
This should now render the html file. Good Job! You have successfully created your first flask app. Edit the html file to change the text inside.