1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Flask Login system

Discussão em 'Python' iniciado por Stack, Setembro 17, 2025.

  1. Stack

    Stack Membro Participativo

    I've just started with flask development and wanted to know if I am going about it the right way.

    I basically want to build a login page with Flask.

    What I understand is:

    1. Make the webapp using flask. I serve the HTML template which is actually my login page.
    2. The user enters the details in the login form.

    Where do I go from here? How do I proceed? I have the username and the password but how do I check the credentials from a database?

    The code that I have is given below:

    from flask import Flask
    from flask import render_template

    app = Flask(__name__)

    @app.route('/')
    def hello_world():
    return 'Hello World!'

    @app.route('/hello')
    def hello():
    return render_template('hello.html')

    if __name__ == '__main__':
    app.run(debug=True)


    This is the flask file code. The HTML code is given below:

    <html>
    <body>
    <form name="login" method="post">
    Username:<input type="text" name=username required placeholder="Username"><br>
    Password:<input type="password" name=pwd required placeholder="Password"><br>
    <input type="submit" value="Login">
    </form>
    <button
    </body>
    </html>


    How do I proceed?

    I am sorry that I am naive on both the web-dev part and flask but both are new to me.

    Continue reading...

Compartilhe esta Página