0

我有以下代码,非常简单:

from flask import Flask
from flask.ext.mongokit import MongoKit, Document
from pymongo import Connection
from pymongo import collection
from pymongo import database
from flask.ext.mongokit import MongoKit, Document
from datetime import datetime
from bson.objectid import ObjectId

app = Flask(__name__)

class data(Document):
    __collection__ = 'xusers'
    __database__ = 'database22'
    structure = {
        'email' : unicode,
        }
app.config['MONGODB_DATABASE'] = 'flask'
app.config['MONGODB_HOST'] = 'localhost' 
app.config['MONGODB_PORT'] = 27017
app.config['MONGODB_USERNAME'] = None
app.config['MONGODB_PASSWORD'] = None   

database22 = MongoKit(app)
database22.register([data])

admin = database22.data()
admin.email = 'admin@admin.com'

并不断收到以下错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/v2/venv/lib/python2.7/site-packages/flask_mongokit.py", line 238, in __getattr__
    self.connect()
  File "/Users/v2/venv/lib/python2.7/site-packages/flask_mongokit.py", line 196, in connect
    host=ctx.app.config.get('MONGODB_HOST'),

这让我发疯,任何帮助将不胜感激。

谢谢!

4

0 回答 0