-3

I am planning to build an app using python-flask and mongodb, but I have absolute zero experience on those. I would like to know Why one prefers MongoDB, and is there any kind of user authentication is possible within the app. i.e., A new user signs up and later authenticates his username and password and gets an access and and start up his session, and simultaneously gets authorization to his data. And once on click of logout link his sessios gets destroyed.

Thanks in advance.

swaroopsm
  • 1,389
  • 4
  • 18
  • 34

2 Answers2

9

and is there any kind of user authentication is possible within the app. i.e., A new user signs up and later authenticates his username and password and gets an access and and start up his session, and simultaneously gets authorization to his data. And once on click of logout link his sessios gets destroyed.

We are not here to code your site for you however I believe this tutorial from 10gen might help you out: http://docs.mongodb.org/manual/tutorial/write-a-tumblelog-application-with-flask-mongoengine/ .

Since you know nout (like me) abut Python I am gonna give you a few tips:

  • Look at tutorials
  • Search Google
  • Understand the nature of your problem and break it down into small parts which you can tackle. Then after you understand those small parts build it up into it's full context.
  • Upvote when people impart their knowledge, it is a sign of gratitude.

Why one prefers MongoDB

As another SOer said above this is extremely subjective so I am gonna send you to some links, these may or may not support the use of MongoDB but they will help you to not fall into the trap of the band wagon:

If you really must ask for my opinion and my opinion only:

  • It is easier to integrate
  • It gets back to basics, no weight on top
  • It is still young and has a lot of promise
  • 10gen seem to have sound ideas about which direction the project should go and they got some of the best working on it.
Community
  • 1
  • 1
Sammaye
  • 43,242
  • 7
  • 104
  • 146
  • The tutorial from 10gen mentioned here has been shifted to [https://docs.mongodb.org/ecosystem/tutorial/write-a-tumblelog-application-with-flask-mongoengine/](https://docs.mongodb.org/ecosystem/tutorial/write-a-tumblelog-application-with-flask-mongoengine/) – uutsav Apr 14 '16 at 16:24
1

Your question is really two questions:

Why one prefers MongoDB

As I mentioned in my comment, this is a pretty subjective question, and as such it doesn't fit well in the StackOverflow Question and Answer design.

Is there any kind of user authentication possible within the app?

MongoDB is simply a database: it stores data. It doesn't provide logic (such as "user authentication" or "shopping cart" or "blog post"). It provides the ability to store general data. You can certainly build applications that deal with authentication using MongoDB.

Flask is simply a framework used to handle web requests. Unlike frameworks like Django, it is designed to handle some "bare necessities", and leaves logic such as "authentication" or "submit a blog post" in control of the programmer to design. So, once again, no out-of-the-box support for authentication, but it's possible to build such a system using Flask and MongoDB as your building blocks.

See some Flask documentation on authentication for more info on some possibilities with Flask.

There are also extensions to Flask that are designed to do authentication.

Community
  • 1
  • 1
Mark Hildreth
  • 42,023
  • 11
  • 120
  • 109