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
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 #4
0
app.config["BOOTSTRAP_SERVE_LOCAL"] = True

dbpath = os.path.join(os.path.abspath(os.path.dirname(__file__)), "data.db")
app.config["SECRET_KEY"] = "I will not tell"
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///{}".format(dbpath)
app.config["SQLALCHEMY_COMMIT_ON_TEARDOWN"] = True
db = SQLAlchemy(app)

login_manager = LoginManager(app)
login_manager.login_view = "login"

# XXX smtp.qq.com:587 failed with SSL.
app.config["MAIL_SERVER"] = "smtp.qq.com"
app.config["MAIL_PORT"] = 587
app.config["MAIL_USE_TLS"] = True
app.config["MAIL_USERNAME"] = os.environ.get("MAIL_USERNAME")
app.config["MAIL_DEFAULT_SENDER"] = app.config["MAIL_USERNAME"]
app.config["MAIL_PASSWORD"] = os.environ.get("MAIL_PASSWORD")
mail = Mail(app)


def send_email(to, subject, template=None, body=None, **kwargs):
    if not isinstance(to, list):
        to = [to]
    msg = Message(subject="[cstcmp] {}".format(subject), recipients=to)
    if template:
        msg.body = render_template(template, **kwargs)
    elif body:
        msg.body = body
    else:
        msg.body = "This is the default body text"
ALLOWED_DEVICES = set(["iOS", "AndroidPhone", "AndroidDevice"])
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 #6
0
from werkzeug.security import generate_password_hash, check_password_hash
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"
import psycopg2
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 #8
0
# for postgresql
# app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://postgres:ID@localhost/flask_example'
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///appdata.db"

# Config values for Flask-Security.
# We're using PBKDF2 with salt.
app.config["SECURITY_PASSWORD_HASH"] = "pbkdf2_sha512"
# Replace this with your own salt.
app.config["SECURITY_PASSWORD_SALT"] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

app.config["SECURITY_EMAIL_SENDER"] = "no-reply@example.com"
# SMTP Server settings (using https://github.com/ThiefMaster/maildump)
app.config["MAIL_SERVER"] = "localhost"
app.config["MAIL_PORT"] = 1025
app.config["MAIL_USE_SSL"] = False
app.config["MAIL_USERNAME"] = ""
app.config["MAIL_PASSWORD"] = ""

# for app registration, confirmation by email
app.config["SECURITY_REGISTERABLE"] = True
app.config["SECURITY_CONFIRMABLE"] = True
app.config["SECURITY_RECOVERABLE"] = True


# Flask-Mail and SQLAlchemy initialization
mail = Mail(app)
db = SQLAlchemy(app)

# Users and Roles table
roles_users = db.Table(
    "roles_users",
Example #9
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)
Example #10
0
db = SQLAlchemy(app)

# 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):
from flask import Markup

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")

Example #12
0
    import oauth
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()
Example #13
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 #14
0
from flask_mail import Mail
from flask_mail import Message
import config

app = Flask(__name__)
# app.config.from_object('config')
app.config["CAS_SERVER"] = "https://netid.rice.edu"
app.config["CAS_AFTER_LOGIN"] = "afterlogin"
app.config["APP_URL"] = "localhost:5000"
app.config.setdefault("CAS_USERNAME_SESSION_KEY", "CAS_USERNAME")
CAS(app)

# Email setup
app.config["MAIL_SERVER"] = "smtp.zoho.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USERNAME"] = config.MAIL_USERNAME
app.config["MAIL_PASSWORD"] = config.MAIL_PASSWORD
app.config["MAIL_USE_TLS"] = False
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_SUPPRESS_SEND"] = False
app.config["TESTING"] = False
mail = Mail(app)


def make_dicts(cursor, row):
    return dict((cursor.description[idx][0], value) for idx, value in enumerate(row))


con = lite.connect("wellbeing.db", check_same_thread=False)
con.row_factory = make_dicts
cur = con.cursor()
Example #15
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 #16
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 #17
0
    "providers.Google": {
        # Client ID
        "consumer_key": "697498708815-abuhifg72qng38ur8mtnhin9347tcmep.apps.googleusercontent.com",
        # Client secret
        "consumer_secret": "uSVAvnfTBwlF4fwHZV9LJ24a",
    },
}

db = MongoEngine(app)
api = MongoRest(app)

# After 'Create app'
app.config["MAIL_SERVER"] = "smtp.example.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = "username"
app.config["MAIL_PASSWORD"] = "password"
app.config["MAIL_SUPPRESS_SEND"] = True
mail = Mail(app)


class SessionAuthentication(AuthenticationBase):
    def authorized(self):
        return current_user.is_authenticated()


def session_authentication_fabric(methods):
    class MethodSessionAuthentication(AuthenticationBase):
        auth_methods = methods

        def authorized(self):
Example #18
0
# -*- coding: utf-8 -*-
__author__ = "florije"

from flask import Flask
import os

app = Flask(__name__)

app.secret_key = "development key"

app.config["MAIL_SERVER"] = "smtp.163.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = "vob636@163.com"
app.config["MAIL_PASSWORD"] = "your-password"

from routes import mail

mail.init_app(app)

basedir = os.path.abspath(os.path.dirname(__file__))
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + os.path.join(basedir, "app.db")

from models import db

db.init_app(app)
with app.app_context():
    # db.create_all()
    pass

import intro_to_flask.routes
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
import os
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 #21
0
from concert1.base import base

# 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)
Example #22
0
    print "checking allowed"
    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
Example #23
0
# Security Features
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
# =============================================================================#

###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 #25
0
# Setting environment variables:
# 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):
Example #26
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"
Example #27
0
app = Flask(__name__)
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)
Example #28
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 #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])
Example #30
0
    return adapter.get_user_by_id(user_id)


@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")