Skip to content

Instantly share code, notes, and snippets.

@mrjoes
Created June 26, 2015 18:57
Show Gist options
  • Save mrjoes/8a60db1ac7136d58f020 to your computer and use it in GitHub Desktop.
Save mrjoes/8a60db1ac7136d58f020 to your computer and use it in GitHub Desktop.
from flask import Flask
from mongoengine import connect
from flask.ext.admin import Admin
from flask.ext.admin.contrib.mongoengine import ModelView
from flask.ext.mongoengine import MongoEngine
class Config(object):
DEBUG = True
MONGODB_SETTINGS = {
'DB': 'db',
'HOST': 'mongodb://localhost:27017/db', 'alias': 'default'
}
SECRET_KEY = 'dogrj0e94jt0pjfpa8jw3rq098jw'
app = Flask(__name__)
app.config.from_object(Config)
db = MongoEngine(app)
admin = Admin(app)
class Model(db.Document):
text = db.StringField(verbose_name='Sid', max_length=255)
stock_count = db.IntField(required=True, default=0)
admin.add_view(ModelView(Model, name='Apps'))
print app.config
app.run()
@rmoskal
Copy link

rmoskal commented Jun 26, 2015

Same issue with this too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment