Python eve和mongodb用户访问

Python eve和mongodb用户访问,python,authentication,flask,eve,Python,Authentication,Flask,Eve,我在settings.py文件中执行Python Eve,它指定以下代码块: # Let's just use the local mongod instance. Edit as needed. # Please note that MONGO_HOST and MONGO_PORT could very well be left # out as they already default to a bare bones local 'mongod'

我在settings.py文件中执行Python Eve,它指定以下代码块:

    # Let's just use the local mongod instance. Edit as needed.

    # Please note that MONGO_HOST and MONGO_PORT could very well be 
    left
    # out as they already default to a bare bones local 'mongod' 
    instance.
    MONGO_HOST = 'localhost'
    MONGO_PORT = 27017

    # Skip these if your db has no auth. But it really should.
    MONGO_USERNAME = '<your username>'
    MONGO_PASSWORD = '<your password>'
#让我们只使用本地mongod实例。根据需要编辑。
#请注意,MONGO_主机和MONGO_端口很可能是
左边
#退出,因为它们已默认为裸体本地“mongod”
例如。
MONGO_主机='localhost'
MONGO_港=27017
#如果数据库没有身份验证,请跳过这些。但它确实应该这样做。
MONGO_用户名=“”
MONGO_密码=“”
但在本教程中,它在Mongo中设置了一个单独的“accounts”集合来处理用户和帐户。它似乎希望您仅为python应用程序创建一个单独的身份验证过程,而不是使用Mongo的内置程序。这是正确的吗?这有什么原因吗

在我看来,将Mongo数据库用户+密码硬编码到服务器上的文件中并不是那么安全,而且尽可能多地使用Mongo自己的身份验证功能更有意义。我知道pymongo有一些工具可以与Mongo用户一起使用,但我想在深入研究之前,先看看这样做是否有充分的理由