from flask import Flask
from flask.ext.mongoengine import MongoEngine
import hashlib

app = Flask(__name__)

HOST = 'oceanic.mongohq.com'
db_settings = {
    'MONGODB_DB': '<db>',
    'MONGODB_USERNAME': '<user>',
    'MONGODB_PASSWORD': '<pass>',
    'MONGODB_PORT': 10046,
}
app.config = dict(list(app.config.items()) + list(db_settings.items()))
app.config["MONGODB_HOST"] = ('mongodb://%(MONGODB_USERNAME)s:%(MONGODB_PASSWORD)s@'+
                               HOST +':%(MONGODB_PORT)s/%(MONGODB_DB)s') % db_settings
secret_key = hashlib.sha1()
app.config["SECRET_KEY"] = secret_key.digest()

db = MongoEngine(app)


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

register_blueprints(app)
Beispiel #2
0
from pymongo import ASCENDING , TEXT
from mongoengine import *
from flask.ext.mongoengine import MongoEngine
from flask.ext.security import Security, MongoEngineUserDatastore, \
    UserMixin, RoleMixin, login_required , AnonymousUser

from flask.ext.login import *
from flask_mail import Mail

app = Flask(__name__,template_folder=template_folder,static_folder=static_folder)

app.app_context().push()

app.config['DEBUG'] = True
app.config['SECRET_KEY'] = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
app.config["MONGODB_HOST"] = MONGODB_HOST
app.config['MONGODB_DB'] = MONGODB_DB
app.config['MONGODB_PORT'] = MONGODB_PORT


"""
The following section sets the overall configuration for flask-security
"""
app.config['SECURITY_PASSWORD_HASH'] = SECURITY_PASSWORD_HASH
app.config['SECURITY_PASSWORD_SALT'] = SECURITY_PASSWORD_SALT
app.config['SECURITY_CONFIRM_SALT'] = SECURITY_CONFIRM_SALT
app.config['SECURITY_RESET_SALT'] = SECURITY_RESET_SALT
app.config['SECURITY_CONFIRMABLE'] = True
app.config['SECURITY_RECOVERABLE'] = True
app.config['SECURITY_CHANGEABLE']  = SECURITY_CHANGEABLE
Beispiel #3
0
from flask import Flask
from flask.ext.mongoengine import MongoEngine
import os
app = Flask(__name__)

app.config["MONGODB_DB"] = os.environ["MONGODB_DB"]
app.config["MONGODB_USERNAME"] = os.environ["MONGODB_USERNAME"]
app.config["MONGODB_PASSWORD"] = os.environ["MONGODB_PASSWORD"]
app.config["MONGODB_HOST"] = os.environ["MONGODB_HOST"]
app.config["MONGODB_PORT"] = os.environ["MONGODB_PORT"]
app.config["SECRET_KEY"] = os.environ["SECRET_KEY"]

db = MongoEngine(app)

from smartmarks.fxns import getCss, getJs, getImg
app.jinja_env.globals.update(getCss=getCss, getJs=getJs, getImg=getImg)

import smartmarks.views
import smartmarks.api_views
Beispiel #4
0
from flask import Flask
from flask.ext.mongoengine import MongoEngine
from flask.ext.csrf import csrf
from flask_oauth import OAuth

app = Flask(__name__, static_folder="static")
app.config["DEBUG"] = True
app.config["SECRET_KEY"] = 'not-secret'

app.config["MONGODB_DB"] = 'confessionsplus'
app.config["MONGODB_HOST"] = 'localhost'
app.config["MONGODB_PORT"] = 27017

app.config["FACEBOOK_APP_ID"] = "328075160635846"
app.config["FACEBOOK_APP_SECRET"] = "36a95cf8babf110ae8b6f7d49c127725"

app.config["SECURITY_REGISTERABLE"] = True

app.config["SECURITY_PASSWORD_HASH"] = "bcrypt"
app.config["SECURITY_PASSWORD_SALT"] = "salty"
app.config["SECURITY_POST_LOGIN"] = "/"
app.config["SECURITY_POST_LOGOUT"] = "/"

oauth = OAuth()
db = MongoEngine(app)
csrf(app)

def register_blueprints(app):
  from views import posts, profile, main, admin
  app.register_blueprint(main)
  app.register_blueprint(posts)
Beispiel #5
0
from flask import Flask
from flask.ext.mongoengine import MongoEngine
app = Flask(__name__)
app.config["MONGODB_DB"] = "DataRoomba"
app.config["MONGODB_HOST"] = "dharma.mongohq.com"
app.config["MONGODB_PORT"] = 10019
app.config["MONGODB_USER"] = "dataroomba"
app.config["MONGODB_PASS"] = "There is no data"
app.config["SECRET_KEY"] = "KeepThisS3cr3t"

db = MongoEngine(app)

if __name__ == '__main__':
    app.run()
Beispiel #6
0
app = Flask(__name__)

env = os.environ.get("FLASK_ENV", "development")
configuration = None
if env == "development":
    app.config["SECRET_KEY"] = config.dev["secret_key"]
    app.config["STRIPE_PUBLISHABLE_KEY"] = config.dev["stripe_publishable_key"]
    stripe.api_key = config.dev["stripe_secret_key"]
    app.config["SEND_FILE_MAX_AGE_DEFAULT"] = 0
    app.config["passwordResetPrefix"] = config.dev["passwordResetPrefix"]
    app.config["MONGODB_DB"] = config.dev["mongodb_db"]
    app.config["SECRET_KEY"] = config.dev["secret_key"]
    app.config["MONGODB_USERNAME"] = config.dev["mongodb_username"]
    app.config["MONGODB_PASSWORD"] = config.dev["mongodb_password"]
    app.config["MONGODB_HOST"] = config.dev["mongodb_host"]
    app.config["MONGODB_PORT"] = config.dev["mongodb_port"]
    app.config["checkoutRedirect"] = config.dev["checkoutRedirect"]
elif env == "production":
    app.config["MONGODB_DB"] = config.production["mongodb_db"]
    app.config["SECRET_KEY"] = config.production["secret_key"]
    app.config["MONGODB_USERNAME"] = config.production["mongodb_username"]
    app.config["MONGODB_PASSWORD"] = config.production["mongodb_password"]
    app.config["MONGODB_HOST"] = config.production["mongodb_host"]
    app.config["MONGODB_HOST"] = config.production["mongodb_host"]
    app.config["MONGODB_PORT"] = config.production["mongodb_port"]
    app.config["STRIPE_PUBLISHABLE_KEY"] = config.production["stripe_publishable_key"]
    app.config["passwordResetPrefix"] = config.production["passwordResetPrefix"]
    app.config["checkoutRedirect"] = config.production["checkoutRedirect"]
    stripe.api_key = config.production["stripe_secret_key"]
Beispiel #7
0
app = Flask(__name__)
"""
app.config["MONGODB_DB"] = "my_tumble_log"
app.config["MONGODB_USERNAME"] = "molsen"
app.config["MONGODB_PASSWORD"] = "shauna"
app.config["MONGODB_HOST"] = "linus.mongohq.com"
app.config["MONGODB_PORT"] = "10038"
#app.config["MONGODB_SETTINGS"] = {"DB": "my_tumble_log"}
#app.config["MONGODB_SETTINGS"] = {'DB': "mongodb://molsen:shauna@linus.mongohq.com:10038/my_tumble_log"}
app.config["SECRET_KEY"] = "KeepThisS3cr3t"
"""
app.config["MONGODB_DB"] = "app12893270"
app.config["MONGODB_USERNAME"] = "molsen"
app.config["MONGODB_PASSWORD"] = "shauna"
app.config["MONGODB_HOST"] = "linus.mongohq.com"
app.config["MONGODB_PORT"] = "10056"
app.config["SECRET_KEY"] = "KeepThisS3cr3t"

db = MongoEngine(app)


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

register_blueprints(app)