Re: [flask] Extending 'Flaskr' for Multiple Users?
- dorian i
- 2012-08-07 @ 18:08
I haven't read the tutorial but i see that you can create blogs.
1. Login users using Flask-Login.
2. Each article/blog/node has a user field.
3. On the admin panel show articles like: select * from Articles where user
= current.user.id (this can be generated with sqlalchemy)
4. The same for when you watch a blog. www.domain.com/username
5. Hashing there are many: check this too functions: from werkzeug.security
import generate_password_hash, check_password_hash
5.1. It is better to use bcrypt, pbkdf2.
6. If each user must have his own domain: Add another field in the user
When a request comes : select * from users where domain = request.domain.
If a record exists make another query to return this users articles like in
If not: abort(404)
The best way is to divide the problem into smaller problems (kinda like i
did) and search in google, stackoverflow, mailing list for each problem.
On Tue, Aug 7, 2012 at 7:38 PM, James Anderson <email@example.com> wrote:
> I'm learning flask and was wondering if anyone had a good example
> somewhere for how I might take the Flaskr tutorial and extend it by
> switching to something like mysql and sqlalchemy (moving away from sqllite
> for production use) and then adding support for multiple users with
> individual "flaskr" sites. So far all the flask tutorials i've found deal
> with single user logon sites and I'd like a more practical "Real world"
> sample of how to handle multi user logins and maybe subsequentialy hashing
> login information as well.