Example #1
0
def bootstrap_flask_app(app):
    """
    Create a new, fully initialized Flask app.

    :param obj app: A Stormpath Application resource.
    :rtype: obj
    :returns: A new Flask app.
    """
    a = Flask(__name__)
    a.config['DEBUG'] = True
    a.config['SECRET_KEY'] = uuid4().hex
    a.config['STORMPATH_API_KEY_ID'] = environ.get('STORMPATH_API_KEY_ID')
    a.config['STORMPATH_API_KEY_SECRET'] = environ.get('STORMPATH_API_KEY_SECRET')
    a.config['STORMPATH_APPLICATION'] = app.name
    a.config['WTF_CSRF_ENABLED'] = False
    StormpathManager(a)

    return a
Example #2
0
from flask.ext.stormpath import (
	StormpathError,
	StormpathManager,
	User,
	login_required,
	login_user,
	logout_user,
	user,
)

app = Flask(__name__)

app.config['DEBUG'] = True
app.config['SECRET_KEY'] = 'a_very_long_secret_key'
app.config['STORMPATH_API_KEY_FILE'] = 'apiKey.properties'
app.config['STORMPATH_APPLICATION'] = 'sweethapp'

stormpath_manager = StormpathManager(app)

#These are the handlers that respond to requests from web browsers
#In Flask handlers are written as Python functions
#Each handler is mapped to one or more request URLs

@app.route('/')
@app.route('/home')
def home():
	#user = {'name':'mpampis'}
	return render_template("home.html")

@app.route('/about')
def about():
	url_for,
)
from flask.ext.stormpath import (
	StormpathError,
	StormpathManager,
	User,
	login_required,
	login_user,
	logout_user,
	user,
)

app = Flask(__name__)
app.config['SECRET_KEY'] = 'nananananananana'
app.config['STORMPATH_API_KEY_FILE'] = 'apiKey-YVVIY4R3LM986736KU1OS4LNX.properties'
app.config['STORMPATH_APPLICATION'] = 'batman_splash'
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0

stormpath_manager = StormpathManager(app)

@app.route('/')
def show_index():
	import netifaces
	interfaces = [interface for interface in netifaces.interfaces() if interface.find('wlan') != -1]
	return render_template('index.html', option_list=interfaces)

@app.route('/error')
def show_error():
	return render_template('error.html')

@app.route('/join', methods=['POST'])
Example #4
0
from flask_stormpath import (
    StormpathError,
    StormpathManager,
    User,
    login_required,
    login_user,
    logout_user,
    user,
)


app = Flask(__name__)
app.config['DEBUG'] = True
app.config['SECRET_KEY'] = 'some_really_long_random_string_here'
app.config['STORMPATH_API_KEY_FILE'] = 'apiKey-VZA0H5166X3L6SMUVINWT5RIX.properties'
app.config['STORMPATH_APPLICATION'] = 'FlaskApp'
app.config['STORMPATH_ENABLE_FORGOT_PASSWORD'] = True

stormpath_manager = StormpathManager(app)

@app.route('/')
def show_posts():
    posts = []
    for account in stormpath_manager.application.accounts:
        if account.custom_data.get('posts'):
            posts.extend(account.custom_data['posts'])

    posts = sorted(posts, key=lambda k: k['date'], reverse=True)
    return render_template('show_posts.html', posts=posts)

Example #5
0


mail = Mail()
# from shound.models import base
 
app = Flask(__name__)
app.config['SQLAlCHEMY_DATABASE_URI'] = 'mysql://user:pass@localhost:3306/showhound'
 


# app.secret_key = 'thisASQWERYTYsecret'

app.config['SECRET_KEY'] = 'thisASQWERYTYsecret'
app.config['STORMPATH_API_KEY_FILE'] = '~/.stormpath/apiKey.properties'
app.config['STORMPATH_APPLICATION'] = 'ShowHound'

stormpath_manager = StormpathManager(app)

app.config["MAIL_SERVER"] = "smtp.gmail.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = 'contact@example.com'
app.config["MAIL_PASSWORD"] = 'your-password'
 
mail.init_app(app)

""" {'Plot': 'Six young people, on their own and struggling to survive in the
real world, find the companionship, comfort and support they get from each other
to be the perfect antidote to the pressures of life.', 'Rated': 'TV-14',
u'Response': 'True', 'Language': 'English', 'Title': 'Friends', 'Country':
Example #6
0
from flask import Flask, jsonify, request, render_template
from flask.ext.stormpath import StormpathManager, login_required, groups_required, user
from cosgrove import db
from cosgrove.ac import crossdomain
import json


app = Flask(__name__)
sakf = 'STORMPATH_API_KEY_FILE'
akpp = '/home/jbert/.stormpath/apiKey.properties'
apps = 'e8412959b1ae2279a15095a81f86fa5c'
app.config['SECRET_KEY'] = "2UXM8ESTB1MVPEO8DOBFDVMBE"
app.config[sakf] = akpp
app.config['STORMPATH_APPLICATION'] = 'erincosgrove.com'
app.config['STORMPATH_REDIRECT_URL'] = '/welcome'

app.config['STORMPATH_ENABLE_FACEBOOK'] = True
app.config['STORMPATH_SOCIAL'] = {
    'FACEBOOK': {
        'app_id': "1455773838012675",
        'app_secret': apps
    }
}


SPM = StormpathManager(app)

def separate_links(links):
    '''
    Jinja2 custom filter for splitting url strings
    '''
Example #7
0
from stormpath.error import Error as StormpathError

app = Flask(__name__)

if "HEROKU" in os.environ:
    Production = True
else:
    app.config['DEBUG'] = True
    Production = False

#Setup Stormpath variables and Redis DB
if Production:
    app.config['SECRET_KEY'] = os.environ['SECRET_KEY']
    app.config['STORMPATH_API_KEY_ID'] = os.environ['STORMPATH_API_KEY_ID']
    app.config['STORMPATH_API_KEY_SECRET'] = os.environ['STORMPATH_API_KEY_SECRET']
    app.config['STORMPATH_APPLICATION'] = os.environ['STORMPATH_APPLICATION']

    url = urlparse.urlparse(os.environ.get('REDISTOGO_URL', 'redis://localhost'))
    redis = redis.Redis(host=url.hostname, port=url.port, db=0, password=url.password)

else:
    app.config['SECRET_KEY'] = "1s2b3c4dzxy"
    app.config['STORMPATH_API_KEY_ID'] = "C1F8HU66CJ64TAY0138WHEJJX"
    app.config['STORMPATH_API_KEY_SECRET'] = "xLPo62taHnzfhEmGGM0d5hfNpsiQqbx2F/bMeyoS5iM"
    app.config['STORMPATH_APPLICATION'] = "TextThem"

    url = urlparse.urlparse("redis://redistogo:8bc0a4a78f077cca60c78cca6e5a8f1e@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
Example #8
0
Config = ConfigParser.ConfigParser()
# Note: This absolute location will need to be edited in production..
Config.read('./meals_conf.ini')

# Setup logging parameters
# Note: remove once deployed in production
logging.basicConfig()
logging.getLogger('sqlalchemy.engine').setLevel(logging.DEBUG)

app = Flask(__name__)

# Stormpath Authentication Setup  #####################################
#   Each paramter is set from the 'meals_conf.ini' config file 
app.config['SECRET_KEY'] = Config.get('SP', 'SECRET_KEY')
app.config['STORMPATH_API_KEY_FILE'] = Config.get('SP', 'API_KEY_FILE')
app.config['STORMPATH_APPLICATION'] = Config.get('SP', 'STORMPATH_APPLICATION')
# Which fields should be displayed when registering new users?
# If this is diabled, only social login can be used.
app.config['STORMPATH_ENABLE_EMAIL'] = \
           Config.getboolean('SP', 'ENABLE_EMAIL')
app.config['STORMPATH_ENABLE_USERNAME'] = \
           Config.getboolean('SP', 'ENABLE_USERNAME')
app.config['STORMPATH_ENABLE_PASSWORD'] = \
           Config.getboolean('SP', 'ENABLE_PASSWORD')
app.config['STORMPATH_ENABLE_GIVEN_NAME'] = \
           Config.getboolean('SP', 'ENABLE_GIVEN_NAME')
app.config['STORMPATH_ENABLE_MIDDLE_NAME'] = \
           Config.getboolean('SP', 'ENABLE_MIDDLE_NAME')
app.config['STORMPATH_ENABLE_SURNAME'] = \
           Config.getboolean('SP', 'ENABLE_SURNAME')
# which fields are required for a non-social account
)
from flask.ext.stormpath import (
	StormpathError,
	StormpathManager,
	User,
	login_required,
	login_user,
	logout_user,
	user,
)

app = Flask(__name__)
app.config['DEBUG'] = True
app.config['SECRET_KEY'] = 'nananananananana'
app.config['STORMPATH_API_KEY_FILE'] = 'apiKey-YVVIY4R3LM986736KU1OS4LNX.properties'
app.config['STORMPATH_APPLICATION'] = 'batphone_setup'

stormpath_manager = StormpathManager(app)

@app.route('/')
def show_index():
	return render_template('index.html')

@app.route('/setup', methods=['POST'])
def setup():
	import sys
	sys.path.append('..')
	from application_management import database_clone
	import threading
	from sockets import TCPServerSocket
	from read_ip_address import read_ip_address
Example #10
0
from flask import (
    Flask,
    abort,
    flash,
    redirect,
    render_template,
    request,
    url_for,
)
from flask.ext.stormpath import (
    StormpathError,
    StormpathManager,
    User,
    login_required,
    login_user,
    logout_user,
    user,
)


app = Flask(__name__)
app.config['DEBUG'] = True
app.config['SECRET_KEY'] = 'some_really_long_random_string_here'
app.config['STORMPATH_API_KEYFILE'] = 'apiKey.properties'
app.config['STORMPATH_APPLICATION'] = 'My Awesome Application'

stormpath_manager = StormpathManager(app)

if __name__ == '__main__':
    app.run()
Example #11
0
File: CSRF.py Project: Rawkcy/CSRF
from flask.ext.stormpath import (
    StormpathError,
    StormpathManager,
    User,
    login_required,
    login_user,
    logout_user,
    user,
)


app = Flask(__name__)
app.config['DEBUG'] = True
app.config['SECRET_KEY'] = 'some_really_long_random_string_here'
app.config['STORMPATH_API_KEY_FILE'] = 'apiKey.properties'
app.config['STORMPATH_APPLICATION'] = 'CSRF'

stormpath_manager = StormpathManager(app)


##### EVIL.COM #####
@app.route('/evil')
def attack():
    return render_template('evil.html')


##### TWEETER #####
@app.route('/tweeter')
def tweet():
    return render_template('tweeter.html')
Example #12
0
    'email':"dummy"
}

slotnum = 1
imagepath = "uploads/"

#Stormpath and Flask initialisations
api_key_file = '~/.stormpath/apiKey.properties'
client = Client(api_key_file_location = expanduser(api_key_file))

app = Flask(__name__)
app.debug = False

app.config['SECRET_KEY'] = 'xxx'
app.config['STORMPATH_API_KEY_FILE'] = expanduser('~/.stormpath/apiKey.properties')
app.config['STORMPATH_APPLICATION'] = 'BITS-Testbed'

#Disable Middle Name as an input while registering
app.config['STORMPATH_ENABLE_MIDDLE_NAME'] = False
#Enable User name so that we can use either username/email for login
# app.config['STORMPATH_ENABLE_USERNAME'] = True
app.config['STORMPATH_ENABLE_SURNAME'] = False
app.config['STORMPATH_ENABLE_GIVEN_NAME'] = False
app.config['STORMPATH_ENABLE_FORGOT_PASSWORD'] = True
#Code uploading
app.config['UPLOAD_FOLDER'] = 'uploads/'
app.config['ALLOWED_EXTENSIONS'] = set(['xml'])

#Packet sniffing
app.config['SECRET_KEY']="secret!"
socketio=SocketIO(app)
Example #13
0
"""
The flask application package.
"""

from flask import Flask
from flask.ext.stormpath import StormpathManager

app = Flask(__name__)
app.config['SECRET_KEY'] = 'kdjfkdkjiic1233nk'
app.config['STORMPATH_API_KEY_FILE'] = r'C:\Scripts\Stormpath\apiKey-3LFWIF8JKNVK34JVSI7EJJUVE.properties'
app.config['STORMPATH_APPLICATION'] = 'GlobalCodesApp'
app.config['STORMPATH_ENABLE_MIDDLE_NAME'] = False
stormpath_manager = StormpathManager(app)


import Global_Codes_App.views
Example #14
0
from flask import Flask
import os
import yaml
from flask.ext.stormpath import StormpathManager

app = Flask(__name__)
app.secret_key = 'SUPERSECRET' # you should change this to something equally random
app.config['CONFIG_FILE'] = os.path.abspath('app/config.yaml')
configStr = open(app.config['CONFIG_FILE'], 'r')
app.config['CONFIG'] = yaml.load(configStr)
app.config['STORMPATH_API_KEY_FILE'] = app.config['CONFIG']['stormpath']['api_key_file']
app.config['STORMPATH_APPLICATION'] = app.config['CONFIG']['stormpath']['app_name']
app.config['STORMPATH_ENABLE_REGISTRATION'] = False
StormpathManager(app)


from views import elastatus as elastatus
app.register_blueprint(elastatus)
)

import re

# Constants
STORY_FOLDER = 'stories/'  # When deploying change to absolute path
DOCX_FOLDER = 'docxs/'
ALLOWED_EXTENSIONS = set(['txt', 'docx'])
URL = "http://127.0.0.1:5000/post/"

# App Settings
app = Flask(__name__)
app.config['DEBUG'] = True
app.config['SECRET_KEY'] = 'some_really_long_random_string_here'# comment out when deploying
app.config['STORMPATH_API_KEY_FILE'] = 'apiKey-695ZMS0M2C6JBHX0W7G4UR9BI.properties'# When deploying change to absolute path
app.config['STORMPATH_APPLICATION'] = 'PeterWakefieldSite'
app.config['UPLOAD_FOLDER'] = DOCX_FOLDER

stormpath_manager = StormpathManager(app)

# Non-route functions

def get_key(a_list):
    return a_list[1]

def allowed_file(filename):
    return '.' in filename and \
           filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS

def get_posts():
    posts = os.listdir(STORY_FOLDER)
Example #16
0
from flask.ext.stormpath import (
    StormpathError,
    StormpathManager,
    User,
    login_required,
    login_user,
    logout_user,
    user,
)


app = Flask(__name__)
app.config['DEBUG'] = True
app.config['SECRET_KEY'] = 'some_really_long_random_string_here'
app.config['STORMPATH_API_KEY_FILE'] = 'apiKey.properties'
app.config['STORMPATH_APPLICATION'] = 'InternWeekenders'

stormpath_manager = StormpathManager(app)

@app.route('/')
def main():
    return redirect(url_for('home'))


#@app.route('/add', methods=['POST'])
#@login_required
#def add_post():
 #   if not user.custom_data.get('posts'):
  #      user.custom_data['posts'] = []

   # user.custom_data['posts'].append({
Example #17
0
'''

from flask import Flask, jsonify, request, make_response, render_template
from flask.ext.stormpath import StormpathManager, login_required, user
from os import environ
from libperk import bulletin, perks, utils, access_control
import json
import wolframalpha
import praw

APP = Flask(__name__)
sakf = 'STORMPATH_API_KEY_FILE'
akpp = '/home/jbert/.stormpath/apiKey.properties'
APP.config['SECRET_KEY'] = # environ.get('PESK')
APP.config[sakf] = akpp  # environ.get('PEAKFILE')
APP.config['STORMPATH_APPLICATION'] = 'PerkEDU'
APP.config['STORMPATH_REDIRECT_URL'] = '/welcome'
'''
APP.config['STORMPATH_ENABLE_FACEBOOK'] = True
APP.config['STORMPATH_SOCIAL'] = {
    'FACEBOOK': {
        'app_id': # environ.get('PEFAK'),
        'app_secret': # environ.get('PEFAS'),
    }
}
'''

SPM = StormpathManager(APP)
CLI = wolframalpha.Client(environ.get('WFK'))
RED = praw.Reddit(user_agent='PerkEDU https://github.com/jamesalbert/PerkEDU')
Example #18
0
    user,
)

from requests import get, post
from sendgrid import SendGridClient, Mail
from stormpath.error import Error as StormpathError

import stripe


app = Flask(__name__)
app.debug = True
app.config['SECRET_KEY'] = environ.get('SECRET_KEY')
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')
app.config['STRIPE_SECRET_KEY'] = environ.get('STRIPE_SECRET_KEY')
app.config['STRIPE_PUBLISHABLE_KEY'] = environ.get('STRIPE_PUBLISHABLE_KEY')
app.config['COINBASE_API_KEY'] = environ.get('COINBASE_API_KEY')

sendgrid = SendGridClient(
    environ.get('SENDGRID_USERNAME'),
    environ.get('SENDGRID_PASSWORD'),
)

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

stripe.api_key = app.config['STRIPE_SECRET_KEY']

Example #19
0
File: app.py Project: dgisser/mapio
from flask.ext.stormpath import login_required, user
from stormpath.cache.redis_store import RedisStore
from restaurants import search,get_business
from findCenter import findCenterMinLargest
from times import getTimes
import urllib2
from sqlalchemy import create_engine
from geoalchemy2 import Geography

app = Flask(__name__)

engine = create_engine('postgresql://gis:gis@localhost/gis', echo=True)
app.config['STORMPATH_SOCIAL'] = {'FACEBOOK': {'app_id': "169054186767605",'app_secret': "023a3dd0cf832d80249d863baec5fef8",},'GOOGLE': {'client_id': "421392893604-t796vp3jjggvc2t296i80v5dhfvch03j.apps.googleusercontent.com",'client_secret': "5EufqXkFoR-fyJI_7Ok1oWdC",}}
app.config['SECRET_KEY'] = 'someprivatestringhere'
app.config['STORMPATH_API_KEY_FILE'] = expanduser('~/.stormpath/apiKey-2NUNTODZJKPTFOZ7PJADHYL01.properties')
app.config['STORMPATH_APPLICATION'] = 'mapio'
app.config['STORMPATH_ENABLE_FORGOT_PASSWORD'] = True
app.config['STORMPATH_ENABLE_MIDDLE_NAME'] = False
app.config['STORMPATH_ENABLE_FACEBOOK'] = True
app.config['STORMPATH_REGISTRATION_REDIRECT_URL'] = '/registered'
app.config['STORMPATH_ENABLE_GOOGLE'] = True

stormpath_manager = StormpathManager(app)
db = SQLAlchemy(app)

class User(db.Model):
  __tablename__ = "users"
  user_id = db.Column(db.Integer, primary_key=True)
  email = db.Column(db.Text, unique=True)
  location = db.Column(Geography('Point,4326'))
Example #20
0
from flask.ext.stormpath import (
    StormpathError,
    StormpathManager,
    User,
    login_required,
    login_user,
    logout_user,
    user,
)

# stormpath settings
app = Flask(__name__)
app.config['DEBUG'] = True
app.config['SECRET_KEY'] = 'some_really_long_random_string_here'
app.config['STORMPATH_API_KEY_FILE'] = 'apiKey.properties'
app.config['STORMPATH_APPLICATION'] = 'heartsing'

# custom settings
app.config['STORMPATH_ENABLE_GIVEN_NAME'] = False
app.config['STORMPATH_ENABLE_MIDDLE_NAME'] = False
app.config['STORMPATH_ENABLE_SURNAME'] = False

stormpath_manager = StormpathManager(app)

# views
# show posts
@app.route('/')
def show_posts():
    posts = []
    for account in stormpath_manager.application.accounts:
        if account.custom_data.get('posts'):
Example #21
0
    StormpathError,
    StormpathManager,
    User,
    login_required,
    login_user,
    logout_user,
    user,
)

# create an instance of the Flask class for our app. __name__ is used for this single application version. If this were a modular app, the Flask app would have to look in different places for static and templates files.
app = Flask(__name__)
# set .config properties in the app.config dictionary of our Flask app, including the our secret key and stormpath config api key file and app 
app.config['DEBUG'] = True
app.config['SECRET_KEY'] = 'fytugheifdhisov86763829u430448fh97g382vyice97c2u4h30r89bu297438y5t89'
app.config['STORMPATH_API_KEY_FILE'] = 'apiKey-3Q8GVT7TSYHSTXT63RK9IAL8O.properties'
app.config['STORMPATH_APPLICATION'] = 'flaskr'

# user-handling app extension
stormpath_manager = StormpathManager(app)

# route() decorator tells Flask what URL should trigger our route function
@app.route('/')
#  function is given a name which is also used to generate URLs for that particular function, and returns the message we want to display in the users browser.
#  stormpath manages user data, so 
def show_posts():
    posts = []
    for account in stormpath_manager.application.accounts:
        if account.custom_data.get('posts'):
            posts.extend(account.custom_data['posts'])

    posts = sorted(posts, key=lambda k: k['date'], reverse=True)
Example #22
0
from flask.ext.stormpath import (
    StormpathError,
    StormpathManager,
    User,
    login_required,
    login_user,
    logout_user,
    user,
)


app = Flask(__name__)
app.config['DEBUG'] = True
app.config['SECRET_KEY'] = 'some_really_long_random_string_here'
app.config['STORMPATH_API_KEYFILE'] = 'apiKey.properties'
app.config['STORMPATH_APPLICATION'] = 'mega-shift'

stormpath_manager = StormpathManager(app)



@app.route('/')
def show_posts():
    posts = []
    for account in stormpath_manager.application.accounts:
        if account.custom_data.get('posts'):
            posts.extend(account.custom_data['posts'])

    posts = sorted(posts, key=lambda k: k['date'], reverse=True)
    return render_template('show_posts.html', posts=posts)