Skip to content

Instantly share code, notes, and snippets.

@TheMuellenator
Forked from angelabauer/index.html
Last active February 2, 2024 13:58
Show Gist options
  • Save TheMuellenator/c6177ac108650fdc8246d29ff0fab284 to your computer and use it in GitHub Desktop.
Save TheMuellenator/c6177ac108650fdc8246d29ff0fab284 to your computer and use it in GitHub Desktop.
Day 60 L458 - Simple HTML Form Revision
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form>
<label>Name</label>
<input type="text" placeholder="name">
<label>Password</label>
<input type="text" placeholder="password">
<button type="submit">Ok</button>
</form>
</body>
</html>
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def home():
return render_template("index.html")
if __name__ == "__main__":
app.run(debug=True)
@mhkocaoglan
Copy link

sory sir, not at all, there are doesns of subjects that needs to be handled. flask is 54 th day and more projects starts after 80 th day.

@DevSingh28
Copy link

My nesting was all messed up. I believe this code works:  Main.py in venv Dictionary: rom flask import Flask, render_template, request app = Flask(name) @app.route('/') def home(): return render_template("index.html") @app.route("/login", methods=["POST"]) def receive_data(): name = request.form["username"] password = request.form["password"] return f"

Name: {name}, Password: {password}

" if name=="main": app.run(debug=True) index.html in templates dictionary <title>Test</title> Name Password Ok Good luck! In a message dated 11/18/2023 10:18:59 AM Eastern Standard Time, @.*** writes:  @DevSingh28 commented on this gist. t a 404 error from running main and clicking on the development server address. Any Sugg can you share your code — Reply to this email directly, view it on GitHub or unsubscribe. You are receiving this email because you commented on the thread. Triage notifications on the go with GitHub Mobile for iOS or Android.

name = request.form["username"]
password = request.form["password"] . The correct usage involves parentheses () rather than square brackets [] for method invocation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment