Custom login checkbox and template rendering

I'm new to learning Python for web development and decided to go with Flask as my framework of choice for now. I chose this primarily for my web development based approach and I want to make as many of my web applications as possible myself. I have created a basic MVC framework in PHP and would like to do something similar in Python. I was looking into some ways to interact with the database and add support for user login / registration, and my initial thoughts were that I wanted to do it all with my own methods and objects, and what not. Similar to how I did it in PHP, so I can learn a lot about how to efficiently create custom functions for long term production projects. In some research I found basic objects in Flask such as Login Manager

,Login-Form

and Flask-Admin

so on. I don't like the idea of ​​using these nicely packaged things that I have very little control over and I don't have dev 'd custom.

Using this stuff, I also feel like I don't understand how it all works at the lowest level, so I couldn't reproduce some of the benefits they give me later in life when the circumstances of the project change and maximum flexibility, customization, maintainability and efficiency. Obviously I'm not in that position right now, but I'm good at DO

writing this stuff in PHP, and I'm just wondering if this means anything to do with session management and authentification myself in Python / Flask, or if my thinking is completely out of ocontext and its not even close to managing the same stuff.

+3


source to share


2 answers


It's a really great idea to learn how low-level authentication works - this is especially important since many people never study this stuff and it's quite interesting!

I would recommend that you take a look at the official Flask tutorial ( http://flask.pocoo.org/docs/0.10/tutorial/ ) as it covers a lot (working with sessions, etc.).

However, I would not recommend using things like this in production.

Using your own authentication code is almost never a good idea - it is much better to rely on a well-maintained library that has been tested by others for security.

In the Flask world, you have a couple of options:



Out of these 3, I really like Flask-Stormpath, but I am very biased as I wrote this =)

Flask-Stormpath supports the widest possible set of settings / etc. and lets you do whatever you need to do.

Hope it helps!

+5


source


The Flask official doc has sample apps. One of them is MiniTwit micro-clone. Since this is a complete app, you could find a lot of what you are looking for. If you want to do something more try the Full Stack Python Flask Tutorial



0


source







All Articles