Example #1
0
File: app.py Project: jerkos/kepavi
def create_app(config=None):
    """Creates the app."""
    # Initialize the app
    app = Flask("Kepavi")

    # Use the default config and override it afterwards
    app.config.from_object('kepavi.configs.default.DefaultConfig')
    # Update the config
    app.config.from_object(config)
    # try to update the config via the environment variable
    app.config.from_envvar("FLASKBB_SETTINGS", silent=True)

    # github extensions, TODO put that into configs directory
    app.config['GITHUB_CLIENT_ID'] = 'ed057c9e07f531f0fdb6'
    app.config['GITHUB_CLIENT_SECRET'] = os.environ.get('GITHUB_CLIENT_SECRET') or GITHUB_CLIENT_SECRET

    app.config['MONGODB_SETTINGS'] = {'db': 'biomodels', 'host': 'mongodb://localhost:27017/biomodels'}

    configure_blueprints(app)

    configure_extensions(app)

    configure_template_filters(app)

    # configure_context_processors(app)

    #configure_before_handlers(app)

    configure_errorhandlers(app)

    #configure_logging(app)

    app.logger.addHandler(logging.StreamHandler(sys.stdout))
    app.logger.setLevel(logging.INFO)
    return app
Example #2
0
def create_app(config_name):
    app = Flask(__name__)
    app.config.from_object(config[config_name])
    try:
        load_dotenv('.env')
        app.config.update(parse_dotenv('.env'))
    except TypeError:
        print('Error parsing .env')
    app.config['MONGODB_SETTINGS'] = {
        'db': app.config['MONGO_DBNAME'],
        'host': app.config['MONGO_URI']
    }
    config[config_name].init_app(app)   
    bootstrap.init_app(app)
    mail.init_app(app)
    moment.init_app(app)
    db.init_app(app)
    login_manager.init_app(app)

    from main import main as main_blueprint
    app.register_blueprint(main_blueprint)
    
    from .auth import auth as auth_blueprint
    app.register_blueprint(auth_blueprint, url_prefix='/auth')
 # attach routes and custom error pages here
    return app
Example #3
0
def get_app():
    #app = Flask(__name__)
    app = Flask('pyfem')
    app.config.from_object(Config)

    # set environment PYFEM_SETTINGS=testing_settings to automatically use a -test version of db
    if os.environ.get('PYFEM_SETTINGS'):
        if os.environ['PYFEM_SETTINGS'] == 'testing_settings':
            app.config['MONGODB_SETTINGS'] = dict(db=app.config['MONGO_DBNAME'] + '-test')

    app.secret_key = app.config['SECRET_KEY']

    app.me = MongoEngine(app)
    app.pymongo = _get_db()

    # app.jinja_env.add_extension('util.Markdown2Extension')
    # app.jinja_env.filters['slugify'] = slugify
    # app.jinja_env.filters['timesince'] = timesince
    # app.jinja_env.filters['timeuntil'] = timeuntil
    # app.jinja_env.filters['jsonencode'] = jsonencode
    # app.jinja_env.globals['newrelic_head'] = newrelic_head
    # app.jinja_env.globals['newrelic_foot'] = newrelic_foot

    # if not app.config.get('TEMPLATE_DEBUG', True):
    #     compiled_templates = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'compiled_templates')
    #     compiled_files = path.path(compiled_templates).files()
    #     if len(compiled_files) <= 1:
    #         app.jinja_env.compile_templates(compiled_templates, zip=None, py_compile=True)
    #     app.jinja_env.loader = ModuleLoader(compiled_templates)

    configure_logging(app)
    return app
Example #4
0
def setup():
    app = Flask(__name__)
    app.config['SECRET_KEY'] = '1'
    app.config['CSRF_ENABLED'] = False
    app.config['MONGODB_SETTINGS'] = {'DB': 'tests'}

    db = MongoEngine()
    db.init_app(app)

    admin = Admin(app)

    return app, db, admin
Example #5
0
def create_app(**config_overrides):
    app = Flask(__name__)
    CORS(app)
    app.config['MONGODB_SETTINGS'] = {
        'db': 'bbs_dev',
        'host': 'localhost',
        'port': 27017
    }
    app.config.update(config_overrides)
    db = MongoEngine(app)

    app.register_blueprint(user_app)
    app.register_blueprint(topic_app)
    app.register_blueprint(search_app)
    app.register_blueprint(message_app)
    app.register_blueprint(node_app)
    app.register_blueprint(image_app)
    app.register_blueprint(reply_app)
    return app
Example #6
0
File: app.py Project: iluddy/flock
# Argument parser
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("-c")
args = arg_parser.parse_args()

# Config
cfg = read_config_file(args.c)

# Create App
app = Flask(__name__, static_url_path='')
app.secret_key = SECRET_KEY
app.permanent_session_lifetime = SESSION_DURATION
documentor = Autodoc(app)
app.config['MONGODB_SETTINGS'] = {
    'db': cfg["database"]["name"],
    'host': cfg["database"]["host"],
    'port': cfg["database"]["port"]
}

# Celery
app.config['CELERY_BROKER_URL'] = cfg['redis']['url']
app.config['CELERY_RESULT_BACKEND'] = cfg['redis']['url']

def make_celery(app):
    celery = Celery(app.import_name, broker=app.config['CELERY_BROKER_URL'])
    celery.conf.update(app.config)
    TaskBase = celery.Task

    class ContextTask(TaskBase):
        abstract = True
        def __call__(self, *args, **kwargs):
Example #7
0
from flask.ext.login import AnonymousUserMixin

from flask import logging
import time
log = logging.getLogger('werkzeug')
#log = logging.getLogger()
count = 0

# Create application
app = Flask(__name__)

# Create dummy secrey key so we can use sessions
app.config['SECRET_KEY'] = '123456790'

# MongoDB settings
app.config['MONGODB_SETTINGS'] = {'DB': 'am2v'}
db = MongoEngine()
db.init_app(app)

# Hum~~ MongoDB another tools
app.config['MONGO_DBNAME'] = 'am2v'
mongo = PyMongo(app)


# Create user model. For simplicity, it will store passwords in plain text.
# Obviously that's not right thing to do in real world application.
class User(db.Document):
  # duplicate error for Mongoengine... 
  '''
  meta = { 
    'abstract' : True, 
Example #8
0
import datetime

from flask import Flask

from flask.ext import admin
from flask.ext.mongoengine import MongoEngine
from flask.ext.admin.form import rules
from flask.ext.admin.contrib.mongoengine import ModelView

# Create application
app = Flask(__name__)

# Create dummy secrey key so we can use sessions
app.config['SECRET_KEY'] = '123456790'
app.config['MONGODB_SETTINGS'] = {'DB': 'testing'}

# Create models
db = MongoEngine()
db.init_app(app)


# Define mongoengine documents
class User(db.Document):
    name = db.StringField(max_length=40)
    tags = db.ListField(db.ReferenceField('Tag'))
    password = db.StringField(max_length=40)

    def __unicode__(self):
        return self.name

Example #9
0
import os

from flask import Flask, render_template, request, redirect, g  
from flask.ext.mongoengine import MongoEngine, MongoEngineSessionInterface
from flask.ext.login import LoginManager


app = Flask("dbmsApp")  #create and name the flask project
app.config['SECRET_KEY'] = '123456790'

# for database connections
app.config['MONGODB_SETTINGS'] = {'HOST':os.environ.get('MONGOLAB_URI'),'DB': 'FlaskLogin'}
app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY')
app.debug = os.environ.get('DEBUG',False)


db = MongoEngine(app)  #connecting mongo engine with flask app
app.session_interface = MongoEngineSessionInterface(db)  #for sessins with mongoengine

login_manager = LoginManager()

login_manager.init_app(app)  #associate flask login manager with current app
Example #10
0
from flask import Flask, render_template, request, make_response, redirect, url_for, session, flash
from flask.ext.bootstrap import Bootstrap
from flask.ext.moment import Moment
from flask.ext.wtf import Form                #imports the base class
from flask.ext.mongoengine import MongoEngine, MongoEngineSessionInterface
from mongoengine import *
from wtforms import StringField, SubmitField  #imports the actual form elements
from wtforms.validators import Required       #imports the actual validators    
from datetime import datetime

app = Flask(__name__) # will set the name of the class to "__main__" since this module is being run stand-alone
app.config['SECRET_KEY'] = 'this is a very hard to guess string with a random word'  #this is required by WTForms to prevent CSRF.
app.config['MONGODB_SETTINGS'] = {'DB': "my_db"}
 
db =  MongoEngine(app) 
bootstrap = Bootstrap(app)
moment = Moment(app)
app.session_interface = MongoEngineSessionInterface(db)

connect('users')

#define the form class
class NameForm(Form):
    first_name = StringField('What is your first name?')
    email_address = StringField('Email Address?', validators=[Required()])
    submit = SubmitField('submit')


#this will put a user in the COLLECTION user. In this case, the database 'my_db' will have a collection called 'User'
#to access in Mongo, I'd get into the database and then do db.user.find() to retrieve records.
class User(db.Document):
Example #11
0
from flask import Flask

from flask.ext.mongoengine import MongoEngine

from internal import auth

from rest import routes
from rest import VinzApi

import settings
import views


# Initialize Flask app and config
app = Flask(__name__)
app.config['MONGODB_SETTINGS'] = settings.MONGODB_DB
app.secret_key = settings.SECRET_KEY

# Initialize Database connection
db = MongoEngine(app)

# Initialize regular Flask views
views.initialize_view_urls(app)

# Initialize authentication module
auth.initialize(app)

# Initialize REST API and REST routes
rest_api = VinzApi(app)
routes.initialize_routes(rest_api)
Example #12
0
from flask import Flask
from flask.ext.mongoengine import MongoEngine


app = Flask(__name__)
app.config['MONGODB_SETTINGS'] = {'DB': 'my_tumble_log'}
app.config['SECRET_KEY'] = 'KeepThisS3cr3t'

db = MongoEngine(app)


def register_blueprints(app):
    # prevents circular imports
    from tumblelog.views import posts
    app.register_blueprint(posts)

register_blueprints(app)


if __name__ == '__main__':
    app.run()

Example #13
0
# -*- coding: utf-8 -*-

from flask import Flask
from flask_mongoengine import MongoEngine
import datetime

app = Flask(__name__)

# Config database
app.config['MONGODB_SETTINGS'] = {'db':'pythonapi_db'}
db = MongoEngine(app)


class Users(db.Document):
    name = db.StringField()
    email = db.StringField(unique=True)
    registered_in = db.DateTimeField(default=datetime.datetime.now())


class Groups(db.Document):
    name = db.StringField(unique=True)
    members = db.ListField()


# if __name__ == '__main__':
#     user_one = Users()
#     user_one.name = 'John Deer'
#     user_one.email = 'john@example.com'
#     user_one.save()

#     user_two = Users()
Example #14
0
	submit = SubmitField('Submit')


#创建Flask对象app,Flask类的构造函数只有一个必须指定的参数,即程序主模块或包的名字.在大多数程序中,Python的__name__变量就是所需要的值
app = Flask(__name__)
#设置密钥,Flask-WTF使用这个密钥生成加密令牌,再用令牌验证请求中表单数据的真伪
app.config['SECRET_KEY'] = 'qlsuxalee'
#debug调试工具
app.config['DEBUG_TB_PANELS'] = ['flask.ext.mongoengine.panels.MongoDebugPanel']
#设置session的有效时间
app.permanent_session_lifetime = timedelta(minutes=5)
#添加mongodb的配置
app.config['MONGODB_SETTINGS'] = {
	'db': 'Game',
	'host': '115.159.161.107',
	'port':27017,
	'username':'root',
	'password':'liu123456'
}
bootstrap = Bootstrap(app)#插件初始化
manager = Manager(app)#命令行解释器
momen = Moment(app)
db = MongoEngine(app)
# toolbar = DebugToolbarExtension(app)

#设置调试模式
app.debug = True

class User(db.Document):
	#定义mongodb的数据库类型
	username = db.StringField(required=True)
Example #15
0
import os

from flask import Flask, make_response, redirect, json, request
from flask.ext.mongoengine import MongoEngine
from werkzeug import secure_filename

from config import HOST, MONGODB_SETTINGS, ALLOWED_EXTENSIONS, UPLOAD_FOLDER

db = MongoEngine()
app = Flask('1mai')
# App configuration
app.config['MONGODB_SETTINGS'] = MONGODB_SETTINGS
app.config['DEFAULT_PARSERS'] = [
    'flask.ext.api.parsers.JSONParser',
    'flask.ext.api.parsers.URLEncodedParser',
    'flask.ext.api.parsers.MultiPartParser'
]
# Start services
db.init_app(app)

class Card(db.Document):
    name = db.StringField(max_length=70, required=True)


def allowed_file(photo_filename):
    if ('.' in photo_filename and
        photo_filename.split('.')[1] in app.config['ALLOWED_EXTENSIONS']):
        return True
    return False

Example #16
0
from flask import Flask
from flask_mongoengine import MongoEngine
from micawber.cache import Cache as OEmbedCache
from micawber import bootstrap_basic


app = Flask(__name__, template_folder='../templates', static_folder='../static')
app.config['ADMIN_PASSWORD'] = 'secret'
app.config['SECRET_KEY'] = '!&b0GDb6m%gFvddrZDj34?_A^pBw9h*'

#UNCOMMENT FOR PRODUCTION DEPLOYMENT
app.config['MONGODB_SETTINGS'] = {
    'db': 'heroku_2ccz1cfc',
    'host': 'mongodb://cdj_blog:unregimentdefromageblanc@ds019478.mlab.com:19478/heroku_2ccz1cfc'
}

#Connect the app to its database. If the block above is in comment, a local database will be used.
db = MongoEngine(app)


# Configure micawber with the default OEmbed providers (YouTube, Flickr, etc).
# We'll use a simple in-memory cache so that multiple requests for the same
# video don't require multiple network requests.appi
oembed_providers = bootstrap_basic(OEmbedCache())


# This is used by micawber, which will attempt to generate rich media
# embedded objects with maxwidth=800.
app.config['SITE_WIDTH'] = 800

Example #17
0
from flask.ext import admin
from flask.ext.mongoengine import MongoEngine
from flask.ext.admin.contrib.mongoengine import ModelView
from flask.ext import admin, wtf
from wtforms import widgets
import redis
import os



app = Flask(__name__)

app.config['SECRET_KEY'] = '123456790'
app.config['MONGODB_SETTINGS'] = {'DB': 'taobao',
                                  "HOST": 'localhost',
                                  "PORT": 27017}

app.__rootdir__ = os.getcwd()


# Create models
db = MongoEngine()
db.init_app(app)
#db.connection.admin.authenticate("root", "chenfuzhi")

app.conn = db.connection
app.redis = redis.Redis("localhost", 6379)

__all__ = ["app", "modes", "api", "views", "cqlui", "blacklist"]
Example #18
0
# Flask Restful get and put sample 

from flask import Flask, request, abort
from flask.ext.restful import Resource, Api
from flask.ext.mongoengine import MongoEngine
from flask_redis import Redis
from flask.ext.bcrypt import Bcrypt
from itsdangerous import (TimedJSONWebSignatureSerializer
                          as Serializer, BadSignature, SignatureExpired)


app = Flask(__name__)
app.config['MONGODB_SETTINGS'] = {
    'db': 'flask-test',
    'host': 'ds027741.mongolab.com',
    'port': 27741,
    'username': 'flask-admin',
    'password': '123123'
}

app.config['REDIS_URL'] = "redis://:123123@pub-redis-17784.us-east-1-2.1.ec2.garantiadata.com:17784/0"
app.config['SECRET_KEY'] = 'flask is cool'

db = MongoEngine(app)
redis_store = Redis(app)
bcrypt = Bcrypt(app)
api = Api(app)

class User(db.Document):
	# email = db.EmailField(unique=True)
    username = db.StringField(unique=True)
Example #19
0
import os
from flask import Flask
from flask.ext.mongoengine import MongoEngine


app = Flask(__name__)
app.config['MONGODB_SETTINGS'] = {
    'db': 'excusemeproject',
    'host': os.environ['EXCUSEMEPROJECT_MONGODB_1_PORT_27017_TCP_ADDR'],
    'port': 27017
}

db = MongoEngine(app)


if __name__ == '__main__':
    app.run(debug=True)
Example #20
0
#!/usr/bin/python
'''
http://blog.csdn.net/qq435792305/article/details/9833353
ORM内置
save 插入
delete 删除

'''
import MySQLdb
from flask_script import Manager
from flask import Flask
from flask.ext.mongoengine import MongoEngine
import datetime

app = Flask(__name__)
app.config['MONGODB_SETTINGS'] = {'DB': 'testMongoDB'}
db = MongoEngine(app)
manager = Manager(app)

# 没有指定collection,使用类名
class User(db.Document):
	name = db.StringField(required=True, max_length=20)
	email = db.StringField()
	time = db.DateTimeField(default = datetime.datetime.now())
	status = db.IntField(default = 0)
	def __str__(self):
		return "id:{}-name:{}".format(self.id,self.name)
# User.query_all()
@manager.command
def save():
	user = User('bingone','abc123@email.com')
Example #21
0
    def default(self, o):
        if isinstance(o, ObjectId):
            return str(o)
        return super(MongoEngineJSONEncoder, self).default(self, o)


# Create application
app = Flask(__name__)
login_manager = login.LoginManager()

app.config['DEBUG'] = True

# Create dummy secrey key so we can use sessions
app.config['SECRET_KEY'] = '123456790'
app.config['MONGODB_SETTINGS'] = {
    'db': 'ai-aggregator',
    'host': os.environ.get('MONGODB_URL', 'mongodb://localhost:27017/ai-aggregator'),
}
app.config.update(
    CELERY_BROKER_URL=os.environ.get('REDIS_URL', 'redis://localhost:6379/0'),
    CELERY_RESULT_BACKEND=os.environ.get('REDIS_URL', 'redis://localhost:6379/0')
)

# Create models
db = MongoEngine()
db.init_app(app)
login_manager.init_app(app)
app.json_encoder = JSONEncoder


# Create user loader function
@login_manager.user_loader
from config import *

app = Flask(__name__)
app.config.from_object('config')

# debug
app.debug = DEBUG
app.config['DEBUG_TB_PANELS'] = ('flask.ext.mongoengine.panels.MongoDebugPanel',)
toolbar = DebugToolbarExtension(app)

# database connection
mongo_conn = MongoClient(host = MONGODB_HOST, port = MONGODB_PORT)
es_conn = ES(ES_SERVER)
app.config['MONGODB_SETTINGS'] = {'DB': 'academi',
        'HOST': '10.77.20.50',
        'PORT': 27017}
mongo_db = MongoEngine(app)

# flask login
login_manager = LoginManager()
login_manager.init_app(app)
login_manager.login_view = 'login'
login_manager.login_message = 'Please login'

# flask admin
if ADMIN:
    admin = config_admin()
    admin.init_app(app)

from app import views
Example #23
0
import datetime
from flask import Flask
from flask_mongoengine import MongoEngine

db = MongoEngine()
app = Flask(__name__, static_url_path='/assets', static_folder='assets')
app.config['MONGODB_SETTINGS'] = {'DB': 'startup'}
db.init_app(app)


class Keyword(db.Document):
    word = db.StringField(unique=True)
    website = db.DictField()
    weibo = db.DictField()
    wechat = db.DictField()
    facebook = db.DictField()
    twitter = db.DictField()
    instagram = db.DictField()
    github = db.DictField()
    created = db.DateTimeField()
    updated = db.DateTimeField(default=datetime.datetime.now)

    def save(self, *args, **kwargs):
        if not self.created:
            self.created = datetime.datetime.now()
        self.updated = datetime.datetime.now()
        return super(Keyword, self).save(*args, **kwargs)

    def __unicode__(self):
        return self.word
Example #24
0
import urllib2,json,urllib
from flask import Flask, render_template, request, session, g, redirect, url_for, abort, flash
from flask.ext.mongoengine import MongoEngine
from flask_debugtoolbar import DebugToolbarExtension
from flask.ext.login import (LoginManager, current_user, login_required,
                            login_user, logout_user, UserMixin, AnonymousUser,
                            confirm_login, fresh_login_required)

USERNAME = 'admin'
PASSWORD = 'default'
SECRET_KEY = 'development key'

app = Flask(__name__)
app.config.from_object(__name__)

app.config['MONGODB_SETTINGS'] = {'DB':'thecvpitch'}

app.debug = True
app.config['DEBUG_TB_PANELS'] = (
    'flask.ext.debugtoolbar.panels.versions.VersionDebugPanel',
    'flask.ext.debugtoolbar.panels.timer.TimerDebugPanel',
    'flask.ext.debugtoolbar.panels.headers.HeaderDebugPanel',
    'flask.ext.debugtoolbar.panels.request_vars.RequestVarsDebugPanel',
    'flask.ext.debugtoolbar.panels.template.TemplateDebugPanel',
    'flask.ext.debugtoolbar.panels.logger.LoggingPanel',
    'flask.ext.mongoengine.panels.MongoDebugPanel'
)

app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False

db = MongoEngine()
Example #25
0
from flask import Flask
from flask.ext.mongoengine import MongoEngine

app = Flask(__name__)

app.config['DEBUG'] = True
app.config['MONGODB_SETTINGS'] = { 'db': 'blask' }
app.config['SECRET_KEY'] = 'SOMERANDOSTRING'

db = MongoEngine(app)

# Import and register the Blueprints
from app.routes.blog import blog
from app.routes.home import home
app.register_blueprint(blog)
app.register_blueprint(home)

# Because our routes are now spread across multiple modules, we need to use the Blueprint name to specify which module the desired route lives in. The string inside a call to url_for is blueprint_name.function_name. We can very easily update home.html to reflect this
# OLD: {{ url_for('home_page') }}
# NEW: {{ url_for('home.home_page') }}
Example #26
0
from flask.ext.mongoengine import MongoEngine
from mongoengine import connect
from wtforms import PasswordField, Form, BooleanField, TextField, validators
from flask import Flask, render_template, request, redirect, flash
import requests
import os

app = Flask(__name__)
app.config["DEBUG"] = True
app.config['MONGODB_SETTINGS'] = { 'db' : 'aliases' }
app.config['SECRET_KEY'] = 'take them glasses off and get in the pool'
app.config['WTF_CSRF_ENABLED'] = True
connect('db',host='mongodb://heroku_jkth7wxw:khf2ufn8j1s9ch8qb64dqq6819@ds059185.mongolab.com:59185/heroku_jkth7wxw')
db = MongoEngine(app)

class LoginForm(Form):
	plaintext = TextField('Alias',[validators.Required(), validators.length(min=6, max=18)])
	password = PasswordField('New Password', [validators.Required(), validators.length(min=6, max=18)])

class Alias(db.Document):
	plaintext = db.StringField(min_length=6,max_length=18,required=True,primary_key=True,unique=True)
	password = db.StringField(min_length=6, max_length=18,required=True)
	location = db.StringField(required=False)
	beacon_w = db.BooleanField(required=False)
	beacon_p = db.BooleanField(required=False)
	beacon_z = db.BooleanField(required=False)
	timestamp = db.StringField(required=False)
	def is_authenticated(self):
		alias = Alias.objects(plaintext=self.plaintext, password=self.password)
		return len(alias) != 0
	def is_active(self):
Example #27
0
import os

from flask import Flask, render_template, request, redirect  # etc.
from flask.ext.mongoengine import MongoEngine, MongoEngineSessionInterface
from flask.ext.login import LoginManager
from flask.ext.bcrypt import Bcrypt
from flask.ext.markdown import Markdown

app = Flask("dwdfall2013")

app.config['MONGODB_SETTINGS'] = {'HOST':os.environ.get('MONGOLAB_URI'),'DB': 'dwdfall2013'}
# app.config['TESTING'] = True
app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY')
app.debug = os.environ.get('DEBUG',False)

db = MongoEngine(app) # connect MongoEngine with Flask App
app.session_interface = MongoEngineSessionInterface(db) # sessions w/ mongoengine

# Flask BCrypt will be used to salt the user password
flask_bcrypt = Bcrypt(app)

# Markdown for Flask
Markdown(app)

# flask login manager
login_manager = LoginManager()
login_manager.init_app(app)
Example #28
0
from flask import Flask
from flask.ext.mongoengine import MongoEngine

app = Flask(__name__)
app.config['MONGODB_SETTINGS'] = {
    'db': 'bikeshare'
}
app.debug = True
db = MongoEngine(app)

import bikeshare_app.views
Example #29
0
# encoding:utf-8
__author__ = 'le'

from flask import Flask
from flask_mongoengine import MongoEngine

app = Flask(__name__)
#app.config.from_object('config')
app.config['MONGODB_SETTINGS'] = {'db': 'todo'}
app.config['SECRET_KEY'] = 'flasktodoapp'
app.config['WTF_CSRF_ENABLED'] = False
db = MongoEngine(app)


from app import views, models
Example #30
0
from flask import Flask
from flask.ext.mongoengine import MongoEngine, MongoEngineSessionInterface
from config import mongo_param

app = Flask(__name__)
app.config.from_pyfile('config.py')
app.config['MONGODB_SETTINGS'] = mongo_param

db = MongoEngine(app)
app.session_interface = MongoEngineSessionInterface(db)

from views import *
from tools import *