Python Flask for Beginners: Build a CRUD web app using Flask

Python Flask for Beginners: Build a CRUD web app using Flask

Did you ever want to find out how powerful is Python when it comes to web development ? Then this course is for you, learn it with CRUD web app.

The demand for Python developers is growing by day and this course has been developed to make sure you are being equipped with the right skills

This course has been rightly designed to help you get comfortable with building web applications using the Flask framework of Python.

Here is an example of a basic CRUD (Create, Read, Update, Delete) web application using Flask and Python:

from flask import Flask, request, render_template

app = Flask(__name__)

todos = []

@app.route("/")
def index():
    return render_template("index.html", todos=todos)

@app.route("/add", methods=["POST"])
def add():
    todo = request.form.get("todo")
    todos.append(todo)
    return redirect(url_for("index"))

@app.route("/update/<int:index>", methods=["POST"])
def update(index):
    todo = request.form.get("todo")
    todos[index] = todo
    return redirect(url_for("index"))

@app.route("/delete/<int:index>", methods=["GET", "POST"])
def delete(index):
    todos.pop(index)
    return redirect(url_for("index"))

if __name__ == "__main__":
    app.run()

This example uses the render_template method from Flask to render an HTML template that displays the to-do items. You can create an index.html file in a templates folder to define the template:

<!DOCTYPE html>
<html>
<head>
  <title>To-Do App</title>
</head>
<body>
  <h1>To-Do App</h1>
  <form action="{{ url_for('add') }}" method="post">
    <input type="text" name="todo">
    <button type="submit">Add</button>
  </form>
  <ul>
    {% for index, todo in enumerate(todos) %}
    <li>
      {{ todo }}
      <form action="{{ url_for('update', index=index) }}" method="post">
        <input type="text" name="todo" value="{{ todo }}">
        <button type="submit">Update</button>
      </form>
      <form action="{{ url_for('delete', index=index) }}" method="post">
        <button type="submit">Delete</button>
      </form>
    </li>
    {% endfor %}
  </ul>
</body>
</html>

To run the application, save the code in a file named app.py and run the following command in your terminal:

export FLASK_APP=app.py
flask run

Now, you can access the application in your web browser at http://localhost:5000/.

You will be provided with the most practical implementation of Python and Flask. No fluff guaranteed.

Flask is a micro framework of Python that is used to build web applications. By the word micro framework, we are not limiting the abilities of Flask. Flask is equally good for larger applications as it is for smaller ones. 

This course will teach you Flask right from the basics, covering more advanced topics where you will finally build a blogging application using Flask.

You’ll learn how to – 

  • Build a dynamic web server using Flask
  • Add templates to your Flask application
  • Use the Jinja2 templating engine of Flask
  • Basic Create, Read, Update, Delete queries of MySQL
  • Connect your Flask application with a MySQL database using flask-mysqldb
  • Add basic styles to your application using flask-bootstrap
  • Integrate your the blogging application written using Flask with a text editor called CKEditor using flask-ckeditor
  • Understand what are GET and POST requests
  • Handle a user session
  • Hash sensitive information submitted by the user

Python has been one of the most easiest language to program. This course assumes that you are comfortable with the basics of Python such as variables, data types, functions and so on. It is also expected that you know the basics of HTML and CSS, and more of that will learn CRUD web app.

I have tried to keep the explanations as simple and practical as possible, and I’m sure you’ll love it.

I’ll always be available to answer any questions that you might have as you progress along.

Udemy offers you a 30 day money back guarantee. Your money is safe. I’ll be happy to help you with a refund in case you are not happy with your purchase.

There is absolutely no risk involved. Enrol into this course and give a worthy upgrade to your Python skillset. I’ll see you on the inside 🙂 learn CRUD web app just here.

What you’ll learn more

  • learn to create a web server using Flask
  • understand the how the web actually works
  • Perform Create, Read, Update and Delete operations of a MySQL database
  • educate with how to use a YAML file to store and retrieve configuration parameters using PyYAML
  • Be comfortable connecting your application to a MySQL database using flask-mysqldb
  • How to use the Jinja2 template engine of Flask
  • Add simple CSS styles to your application using flask-bootstrap
  • Submit a user form through a HTTP POST request
  • Hash sensitive information submitted by the user
  • Understand the difference between a HTTP GET request and a HTTP POST request
  • Integrate CKEditor to your blog application using flask-ckeditor
  • Handle user sessions

No posts found!

Agile project management Artificial Intelligence aws blockchain cloud computing coding interview coding interviews Collaboration Coursera css cybersecurity cyber threats data analysis data breaches data science data visualization devops django docker excel flask Grafana html It Certification java javascript ketan kk Kubernetes machine learning machine learning engineer Network & Security nodejs online courses online learning Operating Systems Other It & Software pen testing Project Management python Software Engineering Terraform Udemy courses VLAN web development


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.