Example #1
0
    def create_app():

        global db, bootstrap, mail, login_manager, moment, pagedown
        app = Flask(__name__)

        from main import main as main_blueprint
        from auth import auth as auth_blueprint
        from admin import admin as admin_blueprint

        app.config["SQLALCHEMY_DATABASE_URI"] = "mysql://flask:gf37888676@172.17.0.25/flask"
        app.config["SQLAlCHEMY_COMMIT_ON_TEARDOWN"] = True
        app.config["FLASK_ADMIN"] = "iamawar3player@163.com"
        app.config["FLASK_MAIL_SUBJECT_PREFIX"] = "[Flasky]"
        app.config["FLASK_MAIL_SENDER"] = "Flasky Admin <iamawar3player@163.com>"
        app.config["MAIL_SERVER"] = "smtp.163.com"
        app.config["MAIL_PORT"] = 25
        app.config["MAIL_USE_TLS"] = False
        app.config["MAIL_USERNAME"] = "iamawar3player@163.com"
        app.config["MAIL_PASSWORD"] = "fan86797121"
        app.config["DEBUG"] = True
        app.config["FLASKY_POSTS_PER_PAGE"] = 10
        app.config["SECRET_KEY"] = "gf37888676"
        app.register_blueprint(main_blueprint)
        app.register_blueprint(auth_blueprint, url_prefix="/auth")
        app.register_blueprint(admin_blueprint, url_prefix="/admin")

        db = db.init_app(app)
        mail = mail.init_app(app)
        bootstrap = bootstrap.init_app(app)
        login_manager = login_manager.init_app(app)
        moment = moment.init_app(app)
        pagedown = pagedown.init_app(app)

        return app
Example #2
0
def create_app():
    app = Flask(__name__)
    app.config.update(CELERY_BROKER_URL="redis://localhost:6379/0", CELERY_RESULT_BACKEND="redis://localhost:6379/0")
    app.config["MAIL_SERVER"] = "smtp.gmail.com"
    app.config["MAIL_PORT"] = 587
    app.config["MAIL_USE_TLS"] = True
    app.config["MAIL_USERNAME"] = admin_imap
    app.config["MAIL_PASSWORD"] = admin_pass
    app.config["MAIL_DEFAULT_SENDER"] = "server-error@example.com"

    return app
Example #3
0
app.secret_key = CryptoUtil.decrypt(config.ENCRYPTED_SESSION_KEY, ENCRYPTION_KEY)

app.config["STRIPE_TOKEN"] = CryptoUtil.decrypt(config.ENCRYPTED_STRIPE_TOKEN, ENCRYPTION_KEY)
app.config["DATABASE_PASSWORD"] = CryptoUtil.decrypt(config.ENCRYPTED_DATABASE_PASSWORD, ENCRYPTION_KEY)
app.config["STRIPE_CACHE_REFRESH_MINUTES"] = config.STRIPE_CACHE_REFRESH_MINUTES
app.config["STRIPE_CACHE_REBUILD_MINUTES"] = config.STRIPE_CACHE_REBUILD_MINUTES
app.config["STRIPE_CACHE_REFRESH_BACKREACH_MIN"] = config.STRIPE_CACHE_REFRESH_BACKREACH_MIN
app.config["ACCESS_CONTROL_HOSTNAME"] = config.ACCESS_CONTROL_HOSTNAME
app.config["ACCESS_CONTROL_SSH_PORT"] = config.ACCESS_CONTROL_SSH_PORT

app.config["MAIL_SERVER"] = config.MAIL_SERVER
app.config["MAIL_PORT"] = config.MAIL_PORT
app.config["MAIL_USE_TLS"] = config.MAIL_USE_TLS
app.config["MAIL_USE_SSL"] = config.MAIL_USE_SSL
app.config["MAIL_USERNAME"] = CryptoUtil.decrypt(config.ENCRYPTED_MAIL_USERNAME, ENCRYPTION_KEY)
app.config["MAIL_PASSWORD"] = CryptoUtil.decrypt(config.ENCRYPTED_MAIL_PASSWORD, ENCRYPTION_KEY)
app.config["ADMIN_PASSPHRASE"] = CryptoUtil.decrypt(config.ENCRYPTED_ADMIN_PASSPHRASE, ENCRYPTION_KEY)
app.config["LOG_FILE"] = config.LOG_FILE

# Logging
file_handler = logging.FileHandler(app.config["LOG_FILE"])
file_handler.setFormatter(logging.Formatter("%(asctime)s - %(levelname)s: %(message)s"))
file_handler.setLevel(logging.INFO)
app.logger.setLevel(logging.INFO)
app.logger.addHandler(file_handler)

app.logger.info("------------------------------")
app.logger.info("SYN Shop Identifyer Started...")
app.logger.info("------------------------------")

# Imports down here so that they can see the app.config elements
Example #4
0
from flask.ext.mail import Mail

basedir = os.path.abspath(os.path.dirname(__file__))
app = Flask(__name__)
app.config["SECRET_KEY"] = "aaaa"
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + os.path.join(basedir, "data.sqlite")
app.config["SQLALCHEMY_COMMIT_ON_TEARDOWN"] = True

app.config["FLASKY_MAIL_SUBJECT_PREFIX"] = "[Flasky]"
app.config["FLASKY_MAIL_SENDER"] = "<moustachedtom@gmail.com>"

app.config["MAIL_SERVER"] = "smtp.googlemail.com"
app.config["MAIL_PORT"] = 587
app.config["MAIL_USE_TLS"] = True
app.config["MAIL_USER_NAME"] = os.environ.get("MAIL_USERNAME")
app.config["MAIL_PASSWORD"] = os.environ.get("MAIL_PASSWORD")


db = SQLAlchemy(app)
manager = Manager(app)
bootstrap = Bootstrap(app)
moment = Moment(app)
migrate = Migrate(app, db)
mail = Mail(app)


class Role(db.Model):
    __tablename__ = "roles"
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(64), unique=True)
    user = db.relationship("User", backref="role")
Example #5
0
bootstrap = Bootstrap(app)
manager = Manager(app)
mail = Mail(app)
app.config["SECRET_KEY"] = "Waht the fuck"
app.config["SQLALCHEMY_DATABASE_URI"] = "mysql://{username}:{password}@{host}/{database}".format(
    username=os.getenv("DB_USERNAME"),
    password=os.getenv("DB_PASSWORD"),
    host=os.getenv("DB_HOST"),
    database=os.getenv("DB_DATABASE"),
)
app.config["SQLALCHEMY_COMMIT_ON_TEARDOWN"] = True
app.config["MAIL_SERVER"] = "smtp.googlemail.com"
app.config["MAIL_PORT"] = 587
app.config["MAIL_USE_TLS"] = True
app.config["MAIL_USERNAME"] = os.getenv("MAIL_USERNAME")
app.config["MAIL_PASSWORD"] = os.getenv("MAIL_PASSWORD")
db = SQLAlchemy(app)
migrate = Migrate(app, db)
manager.add_command("db", MigrateCommand)


class Role(db.Model):
    __tablename__ = "roles"
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(64), unique=True)
    users = db.relationship("User", backref="role")

    def __repr__(self):
        return "<Role {}>".format(self.name)

MAX_LIST_ITEMS = 15

# initiate login manager
login_manager = LoginManager()

# initiate application
app = Flask(__name__)
app.config.update(CELERY_BROKER_URL="redis://localhost:5000/0", CELERY_RESULT_BACKEND="redis://localhost:5000/0")
celery = make_celery(app)
app.config.from_object(__name__)
app.config.from_envvar("FLASK_APP_SETTINGS", silent=True)
app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER
app.config["MAIL_SERVER"] = "smtp.gmail.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USERNAME"] = Onion.MAIL_USERNAME
app.config["MAIL_PASSWORD"] = Onion.MAIL_PASSWORD
app.config["MAIL_USE_TLS"] = False
app.config["MAIL_USE_SSL"] = True
mail = Mail(app)

login_manager.init_app(app)


def has_permissions():
    return current_user.Type in ["admin", "subadmin", "developer"]


def has_admin_permissions():
    return current_user.Type in ["admin"]

Example #7
0
from flask.ext.mail import Mail, Message
from ftplib import FTP
from flask.ext.login import LoginManager, login_required

basedir = os.path.abspath(os.path.dirname(__file__))

app = Flask(__name__)

"""
Note: setting these variables through the local environment & using os.environ to access them is preferred for security reasons
"""
app.config["MAIL_SERVER"] = ""
app.config["MAIL_PORT"] = ""
app.config["MAIL_USE_TLS"] = True
app.config["MAIL_USERNAME"] = "test@test.com"
app.config["MAIL_PASSWORD"] = "testpw"

app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + os.path.join(basedir, "data.sqlite")
# app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL']
# uncomment this line if you want to use Heroku, comment instead the one before it
app.config["SQLALCHEMY_COMMIT_ON_TEARDOWN"] = True

app.config["UPLOAD_FOLDER"] = "./static/balls"

app.permanent_session_lifetime = timedelta(seconds=60)
app.config["SECRET_KEY"] = "veryhard2guess"
# be more original

FTP_USER = "222"
FTP_PASS = "333"
FTP_HOST = "ftp.ftp.com"
from sqlalchemy import *
import os
from werkzeug import secure_filename
from flask.ext.uploads import UploadSet, IMAGES, configure_uploads
from datetime import datetime
import time

mail = Mail()
app = Flask(__name__)
app.secret_key = "a_random_Transformer_secret_key_$%#!@"
app.config["SQLALCHEMY_DATABASE_URI"] = "postgresql+psycopg2://trans:transformer@localhost/mydatabase"
app.config["MAIL_SERVER"] = "smtp.gmail.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = "Transformingthings@gmail.com"
app.config["MAIL_PASSWORD"] = "nonmenclature"
app.config["UPLOAD_FOLDER"] = os.path.realpath(".") + "/static/img/productpics/"  # UPLOAD_FOLDER
mail.init_app(app)
from models import User

photos = UploadSet("photos", IMAGES)


@app.teardown_appcontext
def shutdown_session(exception=None):
    db_session.remove()


@app.route("/signout")
def signout():
Example #9
0
from flask import Flask
from flask.ext.mail import Mail, Message


app = Flask(__name__)
app.config["MAIL_SERVER"] = "smtp.gmail.com"
app.config["MAIL_USERNAME"] = "test.account"
app.config["MAIL_PASSWORD"] = open("/home/sforman/GazAd").read().strip()

# MAIL_DEBUG = default app.debug
# MAIL_SUPPRESS_SEND

mail = Mail(app)

msg = Message(
    "Yo, testing email, DONOTREPLY Yo",
    body="""
"The history of mankind for the last four centuries is rather like that of
an imprisoned sleeper, stirring clumsily and uneasily while the prison that
restrains and shelters him catches fire, not waking but incorporating the
crackling and warmth of the fire with ancient and incongruous dreams, than
like that of a man consciously awake to danger and opportunity."
--H. P. Wells, "A Short History of the World"
""",
    sender="test.account@gazzaleylab.ucsf.edu",
    recipients=["forman.simon@gmail.com", "morgan.hough@gmail.com"],
)
Example #10
0
except ImportError:
    import os
import sentiment
import similar

from flask_mail import Mail, Message

# import logging

app = Flask(__name__)


app.config["MAIL_SERVER"] = "smtp.gmail.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USERNAME"] = os.environ["MAIL_USERNAME"]
app.config["MAIL_PASSWORD"] = os.environ["MAIL_PASSWORD"]
app.config["MAIL_USE_TLS"] = False
app.config["MAIL_USE_SSL"] = True


# app.logger.addHandler(logging.StreamHandler())
# app.logger.setLevel(logging.ERROR)


@app.route("/", methods=["GET", "POST"])
def home():

    viewlist = list()
    viewlocations = list()
    viewscores = list()
    pos_tweets = list()
Example #11
0
import os
from flask import Flask
from flask.ext.mail import Mail, Message
from flask.ext.sqlalchemy import SQLAlchemy
from celery import Celery

app = Flask(__name__)
app.config["SECRET_KEY"] = "top-secret!"

# Flask-Mail configuration
app.config["MAIL_SERVER"] = "smtp.googlemail.com"
app.config["MAIL_PORT"] = 587
app.config["MAIL_USE_TLS"] = True
app.config["MAIL_USERNAME"] = "bdh931101@gmail.com"
app.config["MAIL_PASSWORD"] = "1Alzkdpf*^^*go"
app.config["MAIL_DEFAULT_SENDER"] = "bdh931101@gmail.com"

# Celery configuration
app.config["CELERY_BROKER_URL"] = "redis://localhost:6379/0"
app.config["CELERY_RESULT_BACKEND"] = "redis://localhost:6379/0"
app.config["CELERY_IMPORTS"] = ("app",)
app.config["SQLALCHEMY_DATABASE_URI"] = "postgresql://postgres@localhost/wau"
# app.config.from_object(os.environ['APP_SETTINGS'])

db = SQLAlchemy(app)

# from app.controllers import request_async_crawl
# Initialize extensions
mail = Mail(app)

celery = Celery(app.name, broker=app.config["CELERY_BROKER_URL"])
Example #12
0
from flask import Flask

from flask.ext.stormpath import StormpathManager

app = Flask(__name__, static_folder="static")

app.debug = True
app.config["SECRET_KEY"] = "ilovecookies"

app.config["MAIL_SERVER"] = "smtp.gmail.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USERNAME"] = "ascanio.guarini"
app.config["MAIL_PASSWORD"] = "Scanscan34"
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USE_TLS"] = False

app.config["ADMINS"] = ["ascanio.guarini@gmail.com"]

# import pygeoip

app.config["STORMPATH_API_KEY_ID"] = "WDECSEWR5ZRXCS5G748IJUZ2X"
app.config["STORMPATH_API_KEY_SECRET"] = "4v6z2bLKzcNHaY6r6N8nMASxJ1FiOyZjt2XfDSuZcTI"
app.config["STORMPATH_APPLICATION"] = "flaskapp"

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

from routes import mail

mail.init_app(app)
Example #13
0
app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER

app.config["SQLALCHEMY_DATABASE_URI"] = "mysql+mysqldb://root:root@localhost/finalproject"

db.init_app(app)

app.secret_key = "tkssmartkodecodeWorldProdigy232323421@1127@6206birthd#2342)2**("


mail = Mail()
app.config["MAIL_SERVER"] = "smtp.live.com"
app.config["MAIL_PORT"] = 587
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = "uwimonaevals@outlook.com"
app.config["MAIL_PASSWORD"] = "uwimonas;"

mail.init_app(app)

app.config["MYSQL_USER"] = "root"
app.config["MYSQL_PASSWORD"] = "root"
app.config["MYSQL_DB"] = "finalproject"


mysql = MySQL(app)


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

Example #14
0
import sys

sys.path.append("../")

from flask import Flask
from honeyvault_config import *

app = Flask(__name__)

app.secret_key = "development key"

app.config["MAIL_SERVER"] = "smtp.gmail.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = "rchat@cs.wisc.edu"
app.config["MAIL_PASSWORD"] = "1233456"

from routes import mail

mail.init_app(app)

import intro_to_flask.routes
Example #15
0
    from settings_local import MAIL_PORT
    from settings_local import MAIL_USE_TLS
    from settings_local import MAIL_USERNAME
    from settings_local import MAIL_PASSWORD
    from settings_local import DEFAULT_MAIL_SENDER
except ImportError:
    MAIL_SERVER = "localhost"
    MAIL_PORT = 25
    MAIL_USE_TLS = False
    MAIL_USERNAME = MAIL_PASSWORD = DEFAULT_MAIL_SENDER = None

rsvp_app.config["MAIL_SERVER"] = MAIL_SERVER
rsvp_app.config["MAIL_PORT"] = MAIL_PORT
rsvp_app.config["MAIL_USE_TLS"] = MAIL_USE_TLS
rsvp_app.config["MAIL_USERNAME"] = MAIL_USERNAME
rsvp_app.config["MAIL_PASSWORD"] = MAIL_PASSWORD
rsvp_app.config["DEFAULT_MAIL_SENDER"] = DEFAULT_MAIL_SENDER

mail = Mail(rsvp_app)

basedir = os.path.abspath(os.path.dirname(__file__))
rsvp_app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + os.path.join(basedir, "rsvp.db")  # 'sqlite:////tmp/test.db'
rsvp_app.config["SQLALCHEMY_MIGRATE_REPO"] = os.path.join(basedir, "db_repository")

db = SQLAlchemy(rsvp_app)
# CORS(rsvp_app)  # allow all origins

# LOGGING

logging.basicConfig(
    filename="/tmp/aniairadek.log",
Example #16
0
import os
from flask import Flask
from werkzeug import secure_filename


UPLOAD_FOLDER = "./uploads/"
ALLOWED_EXTENSIONS = set(["txt", "pdf", "png", "jpg", "jpeg", "gif"])

app = Flask(__name__)
app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER
app.secret_key = "development key"

app.config["MAIL_SERVER"] = "smtp.gmail.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = "joeterskine@gmail.com"
app.config["MAIL_PASSWORD"] = "Pavilion12"

from routes import mail

mail.init_app(app)

app.config["SQLALCHEMY_DATABASE_URI"] = "mysql://root:password@localhost/development"

from models import db

db.init_app(app)

import creighton.routes
Example #17
0

@app.errorhandler(400)
def page_not_found(e):
    return render_template("login.html"), 400


app.config.from_object("config")

app.config["SECURITY_POST_LOGIN"] = "/profile"
app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER

app.config["MAIL_SERVER"] = "smtp.gmail.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USERNAME"] = "arqsoft12015@gmail.com"
app.config["MAIL_PASSWORD"] = "arquitectura2015"
app.config["MAIL_USE_TLS"] = False
app.config["MAIL_USE_SSL"] = True

api.add_resource(HomeController, "/", endpoint="home")
api.add_resource(RegisterController, "/register", endpoint="register")
api.add_resource(LoginController, "/login", endpoint="login")
api.add_resource(LogoutController, "/logout", endpoint="logout")
api.add_resource(PerfilController, "/perfil", endpoint="perfil")
api.add_resource(EditarUsuarioController, "/editarme", endpoint="editar_perfil")
api.add_resource(EventoController, "/evento/<evento_id>", endpoint="evento")
api.add_resource(EditarEventoController, "/editar/<evento_id>", endpoint="editar_evento")
api.add_resource(NuevoEventoController, "/nuevo_evento", endpoint="nuevo_evento")
api.add_resource(CrearRecursoController, "/crear_recurso", endpoint="crear_recurso")
api.add_resource(AsignarRecursoController, "/asignar_recurso", endpoint="asignar_recurso")
api.add_resource(EventoYAsistenciaController, "/evento_asistencia", endpoint="evento_asistencia")
mail = Mail()

app = Flask(__name__)

app.register_blueprint(website, url_prefix="/")
app.register_blueprint(posts, url_prefix="/posts")
app.register_blueprint(admin, url_prefix="/admin")

app.secret_key = "development key"

app.config["MAIL_SERVER"] = "smtp.gmail.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = "lanigouws@gmail.com"
app.config["MAIL_PASSWORD"] = "LeeGordonMcKillop1968"

mail.init_app(app)


@app.route("/")
def index():
    return render_template("layout.html")


@app.route("/home")
def home():
    return render_template("home.html")


@app.route("/about")
Example #19
0
from flask import Flask, render_template, request  # NEW IMPORT -- request
from forms import ContactForm  # NEW IMPORT LINE
from flask.ext.mail import Message, Mail

mail = Mail()
app = Flask(__name__)  # This is creating a new Flask object

app.secret_key = "WebDesign"

app.config["MAIL_SERVER"] = "smtp.gmail.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = "dperillo@umich.edu"
app.config["MAIL_PASSWORD"] = "fortunamajor13!?"

mail.init_app(app)
# decorator that links...
@app.route("/")  # This is the main URL
def default():
    return render_template("index.html", name="index", title="HOME")


@app.route("/index")  # This is the main URL
def home():
    return render_template("index.html", name="index", title="HOME")  # The argument should be in templates folder


@app.errorhandler(404)
def pageNotFound(e):
    return render_template("404.html"), 404
Example #20
0
# secrets...
import creds

app.config.from_pyfile("creds.py")

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

from flask.ext.mail import Message, Mail

mail = Mail()
app.config["MAIL_SERVER"] = "smtp.live.com"
app.config["MAIL_PORT"] = 587
app.config["MAIL_USE_TLS"] = True
app.config["MAIL_USERNAME"] = creds.cred["mailu"]
app.config["MAIL_PASSWORD"] = creds.cred["mailpass"]
mail.init_app(app)

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Model
class List(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name_a = db.Column(db.Unicode(64))
    tag_f1 = db.Column(db.String(255))

    def __unicode__(self):
        return self.name


class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
Example #21
0
# FLASK_APP_DIR = os.path.dirname(os.path.abspath(__file__))

# Create app
app = Flask(__name__)

# Config requires legit Gmail username and password
# Move eventually to config.py w/ diff config for production
app.config["DEBUG"] = True
app.config["SECRET_KEY"] = "super-secret"
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///test.db"
app.config["MAIL_SERVER"] = "smtp.example.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = "sean@concerttalent.com"
app.config["MAIL_PASSWORD"] = "password"
app.config["DEFAULT_MAIL_SENDER"] = "Admin < sean@concerttalent.com >"
# mail = Mail(app)

# Create database connection object
db = SQLAlchemy(app)

"""
# Define models
roles_users = db.Table('roles_users',
        db.Column('user_id', db.Integer(), db.ForeignKey('user.id')),
        db.Column('role_id', db.Integer(), db.ForeignKey('role.id')))

class Role(db.Model, RoleMixin):
    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(80), unique=True)
Example #22
0
# Initiate Bower
Bower(app)

# Sample HTTP error handling
@app.errorhandler(404)
def not_found(error):
    return render_template("404.html"), 404


# Import a module / component using its blueprint handler variable (mod_auth)

app.config["MAIL_SERVER"] = "evop5.areserver.net"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = "pruebas.cms@asacoop.com"
app.config["MAIL_PASSWORD"] = "admin1234"
mail = Mail(app)

# RESTful
api = Api(app)

# Import a module / component using its blueprint handler variable (mod_auth)
from app.authentication.controllers import mod_auth as auth_module

# from app.sections.controllers import mod_sec as sec_module
from app.sections.controllers import api_db as sec_module


# Register blueprint(s)
app.register_blueprint(auth_module)
app.register_blueprint(sec_module)
Example #23
0
app.config["SECURITY_REGISTERABLE"] = user_enable_registration
app.config["SECURITY_TRACKABLE"] = user_enable_tracking
app.config["SECURITY_EMAIL_SENDER"] = user_from_email
app.config["SECURITY_PASSWORD_HASH"] = pwhash
app.config["SECURITY_PASSWORD_SALT"] = salt
app.config["SECURITY_CONFIRMABLE"] = True
app.config["SECURITY_EMAIL_SUBJECT_REGISTER"] = user_register_email_subject

# Email
app.config["MAIL_SERVER"] = mail_url
app.config["DEBUG"] = False
app.config["MAIL_PORT"] = mail_port
app.config["MAIL_USE_SSL"] = mail_SSL
app.config["MAIL_USE_TLS"] = mail_TLS
app.config["MAIL_USERNAME"] = mail_user
app.config["MAIL_PASSWORD"] = mail_pass
app.config["MAIL_SUPPRESS_SEND"] = False


# Create database connection object
db = MongoEngine(app)
# Bootstrap
Bootstrap(app)
# Setup Mail
mail = Mail(app)
mail.init_app(app)

# mail test
with mail.record_messages() as outbox:
    mail.send_message(subject="testing", body="test", recipients=["ryan@solidarray.com"])
Example #24
0
import random
import time
from flask import Flask, request, render_template, session, flash, redirect, url_for, jsonify
from flask.ext.mail import Mail, Message
from celery import Celery


app = Flask(__name__)
app.config["SECRET_KEY"] = "top-secret!"

# Flask-Mail configuration
app.config["MAIL_SERVER"] = "smtp.126.com"
app.config["MAIL_PORT"] = 25
app.config["MAIL_USE_TLS"] = True
app.config["MAIL_USERNAME"] = "ahuthulei"
app.config["MAIL_PASSWORD"] = "342426110shwill"
app.config["MAIL_DEFAULT_SENDER"] = "ahuthulei@126.com"

# Celery configuration
app.config["CELERY_BROKER_URL"] = "redis://localhost:6379/0"
app.config["CELERY_RESULT_BACKEND"] = "redis://localhost:6379/0"


# Initialize extensions
mail = Mail(app)

# Initialize Celery
celery = Celery(app.name, broker=app.config["CELERY_BROKER_URL"])
celery.conf.update(app.config)

Example #25
0
# export <CONFIG_VARIABLE_NAME>=<CONFIG_VARIABLE>

# Hash Key
app.config["SECRET_KEY"] = "REMEMBER TO CHANGE THIS USE ENVIRONMENT VARS"

# SQLAlchemy
app.config["SQLALCHEMY_DATABASE_URI"] = "mysql+pymysql://root:openflow@localhost:3306/smp"
app.config["SQLALCHEMY_COMMIT_ON_TEARDOWN"] = True


# Email
app.config["MAIL_SERVER"] = "michaelangelo.zuver.net.au"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = "sdn@petertriho.com"  # os.environ.get('MAIL_USERNAME')
app.config["MAIL_PASSWORD"] = "sdnpass#2015"  # os.environ.get('MAIL_PASSWORD')
app.config["MAIL_SUBJECT_PREFIX"] = "[reSiDeNce] "
app.config["MAIL_SENDER"] = "reSiDeNce Admin <sdn@petertriho.com>"

# ------------#
# Extensions #
# ------------#
db = SQLAlchemy(app)
api = Api(app)
auth = HTTPBasicAuth()
mail = Mail(app)


@app.after_request
def after_request(response):
    response.headers.add("Access-Control-Allow-Origin", "*")
Example #26
0
    return "." in filename and filename.rsplit(".", 1)[1] in ALLOWED_EXTENSIONS_NOTES


def allowed_img_file(filename):
    return "." in filename and filename.rsplit(".", 1)[1] in ALLOWED_EXTENSIONS_PICS


########## end File Upload Setup ##########

########## Mail Setup ##########
mail = Mail()
app.config["MAIL_SERVER"] = "mail.mrscutrona.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = "bugs@mrscutrona.com"
app.config["MAIL_PASSWORD"] = config.epw
mail.init_app(app)
########## end Mail Setup ##########

########## Pagination Setup ##########
PER_PAGE = 5


def url_for_other_page(page):
    args = dict(request.view_args.items() + request.args.to_dict().items())
    args["page"] = page
    return url_for(request.endpoint, **args)


app.jinja_env.globals["url_for_other_page"] = url_for_other_page
########## end Pagination Setup ##########
Example #27
0
from flask import Flask, render_template, request, flash
from forms import ContactForm
from flask.ext.mail import Message, Mail

mail = Mail()

app = Flask(__name__)

app.secret_key = "development key"

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)


@app.route("/")
def home():
    return render_template("home.html")


@app.route("/about")
def about():
    return render_template("about.html")


@app.route("/contact", methods=["GET", "POST"])
def contact():
Example #28
0
###flask app init###
# =============================================================================#
app = Flask(__name__)
app.secret_key = "xbaxf903x1axc9xeaTSsx0bx9ax85xcbx8ax12Vx8czn~x9e2"
# =============================================================================#

###flask mail config###
# =============================================================================#
app.config["SECRET_SALT"] = "whenLifeGivesYouSalt"  # make hashed email addresses...get it? I'll show myself out..
app.config["MAIL_SERVER"] = "smtp.gmail.com"
app.config["MAIL_PORT"] = 587
app.config["MAIL_USE_TLS"] = True
app.config["MAIL_USE_SSL"] = False
app.config["MAIL_USERNAME"] = "sam.flaskappsample@gmail.com"
app.config["MAIL_PASSWORD"] = "flaskpassword"
app.config["MAIL_DEFAULT_SENDER"] = "sam.flaskappsample@gmail.com"

# create mail instance
mail = Mail(app)
# =============================================================================#

###Database Connection###
# =============================================================================#
mysql_details = {
    "DB_HOST": "C00165099.mysql.pythonanywhere-services.com",
    "DB_USER": "C00165099",
    "DB_PASS": "flaskpassword",
    "DB_NAME": "C00165099$flaskapp",
}
# =============================================================================#
Example #29
0
from flask import Flask
from flask import current_app
from flask.ext.mail import Mail
from flask.ext.mail import Message
from threading import Thread

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

# these configs must be set before creating mail instance
app.config["MAIL_SERVER"] = "smtp.qq.com"
app.config["MAIL_PORT"] = 25
app.config["MAIL_USE_TLS"] = True
app.config["MAIL_USE_SSL"] = False
app.config["MAIL_USERNAME"] = "36838082@qq.com"
app.config["MAIL_PASSWORD"] = "xx"
mail = Mail(app)


def send_async_email(app, msg):
    with app.app_context():
        mail.send(msg)


@app.route("/mail")
def SendMail():
    msg = Message("test", sender="36838082@qq.com", recipients=["hermasTang@hotmail.com"])
    msg.body = "text body"
    msg.html = "<b>HTML</b>body"
    thr = Thread(target=send_async_email, args=[app, msg])
    thr.start()
Example #30
0
from flask import Flask, render_template, url_for
from flask_mail import Mail, Message
from werkzeug.utils import redirect

from forms import ContactForm

app = Flask(__name__)
app.secret_key = "Y\xd5^\xa1{\xf3\n\xf7s\xedz\x945zM\xa0;&'\xd9.\xade"

# add mail server config
app.config["MAIL_SERVER"] = "smtp.gmail.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = "joeracostawebsite@gmail.com"
app.config["MAIL_PASSWORD"] = "joeswebsite"

mail = Mail(app)


@app.route("/")
def home():
    form = ContactForm()
    return render_template("index.html", form=form)


@app.route("/contact", methods=("GET", "POST"))
def contact():
    form = ContactForm()

    if form.validate() == False:
        return "Error. All fields not filled in"