7
Bubbles
15d

Low key if someone wants to help me with a flask registration form that would be great because it’s kicking my ass.

If you didn’t see my last rant I switched from php to python because I know python and php didn’t like working or doing anything.

Comments
  • 0
    Some more information might be helpful.
  • 2
    @sbiewald oh my apologies.

    So I need a login/signup program. It doesn’t need security (it’s not for real production just an example project for some of the students at this school) and I’m trying to work on the SQLite database to go with the whole log in and sign up functions.

    I’ve been trying to do it myself but I’m having a lot of trouble understanding how everything in flask works.
  • 0
    Have you created any base user classes or Auth classes?
  • 0
  • 2
    I'll drop a small snippet here, maybe it helps:

    from flask import request

    ...

    @app.route('/signup', methods=['get', 'post'])
    def signup():
    if request.method == 'GET:
    return signup_form_HTML
    else:
    # Form data is in request.form[key]
    do_db_actions() # SQLite or whatever
    return response_HTML

    The request object is unique to every request.
  • 1
    It might be overkill for something small but start there.

    You could go for a base use class/model with a login, logout and password reset method.

    Set up your base user, assuming you're using SQLalchemy. Create a view that instantiates the class, create as new one, saves it to the DB and you're good to go.

    In fact, the Flask SQLalchemy docs have a great simple example of this:

    http://flask.pocoo.org/docs/0.12/...

    Or better yet: https://blog.miguelgrinberg.com/pos...
  • 1
    I was using SQLite but I could try SQLAlchemy. I’m just trying to get this done as soon as I can. My problems are mostly coming from that I’m trying to learn flask as I go and I can’t understand any of it
  • 1
    If anyone could add me on discord and help so it’ll be easier to have a conversation that would be great
    BubbsTheSupreme#0157
  • 1
    SQLalchemy is just an interface for SQLite. It can be confusing at first but you'll very quickly get stuff built. Flask is super quick to get going.
  • 1
    @Charon92 wait so do I import SQLite as well as alchemy?
  • 1
    And if it means simplifying and shortening a lot of the project I’ll even use JSON as a simple database which never crossed my mind until now
  • 0
    Give me 20 minutes and I'll have a simple skeleton up to try and explain it all better. It's hard to do over DevRant without pasting code snippets and reformatting everything.
  • 0
    @Charon92 are we gonna continue using devRant or sumn else. And I can wait No worried thank you for help
  • 0
    I have the css and html although I don’t know what I have to do with some of the html to get it to work with Flask. I want to learn I just can’t understand it.
  • 2
    @Bubbles
    a) defined the 'routes', e.g. functions for the sites (see above)
    b) return the HTML in the functions

    CSS is placed in the static folder. It is reachable with /static/ in the URL.

    The Flask quick start guide is quite helpful: http://flask.pocoo.org/docs/1.0/...
  • 0
    @Bubbles

    Hey dude, sorry for the delay.

    Before I continue, go and read the docs and the small tutorial I posted and the one @sbiewald posted below.

    Now, after you've done that - https://gitlab.com/Charon92/...

    Here's a VERY basic version of what you're trying to do. It supports everything you need but, use it as a last resort. Try to understand how it works and what it's doing. If something doesn't make sense, hit me up on here or on Discord (which I just redownloaded) name there is Charon92 as well.
  • 2
    @sbiewald

    If I could give you more ++'s I would.
  • 0
    @sbiewald I’m not really able to understand. I can return files but that’s about it. I have a program written but I don’t know why. And i can’t understand the fixes and explainations on SO because I don’t even know what I did wrong in the first place
  • 0
    @Bubbles

    There's also the DevRant Discord channel as well, which I'll now be in for a bit.
  • 0
    @Charon92 what’s the numbers for your name
  • 0
  • 1
Your Job Suck?
Get a Better Job
Add Comment