예제 #1
0
    app.config['STORMPATH_APPLICATION'] = "TextThem"

    url = urlparse.urlparse("redis://*****:*****@dab.redistogo.com:9082/")
    redis = redis.Redis(host=url.hostname, port=url.port, db=0, password=url.password)

app.config['STORMPATH_ENABLE_USERNAME'] = True
app.config['STORMPATH_REQUIRE_USERNAME'] = True
app.config['STORMPATH_ENABLE_FORGOT_PASSWORD'] = True
app.config['STORMPATH_REGISTRATION_TEMPLATE'] = 'register.html'
app.config['STORMPATH_LOGIN_TEMPLATE'] = 'login.html'
app.config['STORMPATH_FORGOT_PASSWORD_TEMPLATE'] = 'forgot.html'
app.config['STORMPATH_FORGOT_PASSWORD_EMAIL_SENT_TEMPLATE'] = 'forgot_email_sent.html'
app.config['STORMPATH_FORGOT_PASSWORD_CHANGE_TEMPLATE'] = 'forgot_change.html'
app.config['STORMPATH_FORGOT_PASSWORD_COMPLETE_TEMPLATE'] = 'forgot_complete.html'

stormpath_manager = StormpathManager(app)
stormpath_manager.login_view = 'login'

#Store messages in redis database.
def logMessage(number, message):
    try:
        redis.rpush(user.username + "_Messages", number + " " + message)
        print("LOGGED")
    except Exception as e:
        print(e.message)

def generateMessage():
    """Generate a random adjective and noun

    Returns:
        tuple - (string, string) - (adjective, noun)
예제 #2
0
파일: wsgi.py 프로젝트: gtmanfred/bingo
import os
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.cors import CORS
from flask.ext.stormpath import StormpathManager

app = Flask(__name__)
app.config.from_object('config.{0}'.format(os.getenv('APP_SETTINGS',
                                                     'Config')))
app.debug = True
db = SQLAlchemy(app)
StormpathManager(app)
CORS(app)

import bingo.api.app
import bingo.client.app
app.register_blueprint(bingo.api.app.create_app())
app.register_blueprint(bingo.client.app.create_app())
예제 #3
0
from flask.ext.stormpath import (
	StormpathError,
	StormpathManager,
	User,
	login_required,
	login_user,
	user
	)

app = Flask(__name__)
app.config['DEBUG'] = True
app.config['SECRET_KEY'] = '6fZIfY+2kEcQFd69t2GHPJEqlGCQcLPIe96ehFtXlQw'
app.config['STORMPATH_API_KEY_FILE'] = 'apiKey.properties'
app.config['STORMPATH_APPLICATION'] = 'flaskr'

stormpath_manager = StormpathManager(app)

# @app.before_request
# def before_request():
# 	pwdb.connect()

# @app.after_request
# def after_request(response):
# 	pwdb.close()
# 	return response

@app.route('/')
def show_posts():
	posts = []
	for account in stormpath_manager.application.accounts:
		if account.custom_data.get('posts'):
예제 #4
0
from os import environ

from flask import Flask, redirect, render_template, request, url_for
from flask.ext.stormpath import StormpathManager, User, login_required, login_user, logout_user, user
from stormpath.error import Error as StormpathError

app = Flask(__name__)
app.debug = True
app.config['SECRET_KEY'] = 'dollyiscrazy'
app.config['STORMPATH_API_KEY_ID'] = environ.get('STORMPATH_API_KEY_ID')
app.config['STORMPATH_API_KEY_SECRET'] = environ.get(
    'STORMPATH_API_KEY_SECRET')
app.config['STORMPATH_APPLICATION'] = environ.get('STORMPATH_APPLICATION')

stormpath_manager = StormpathManager(app)
stormpath_manager.login_view = '.login'


##### Website
@app.route('/')
def index():
    """Basic home page."""
    return render_template('index.html')


@app.route('/register', methods=['GET', 'POST'])
def register():
    """
    This view allows a user to register for the site.