Beispiel #1
0
from urllib.parse import unquote
import simplejson as json
import traceback
from xml.sax.saxutils import escape

# Initialize the Flask application
mail = Mail()

app = Flask(__name__)

app.secret_key = 'mega secret open source development key 008'

with open('conf.txt', 'r') as f:
    data = f.readlines()

app.config["MAIL_SERVER"] = data[2].strip()
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = data[0].strip()
app.config["MAIL_PASSWORD"] = data[1].strip()

#max word amount permitted
app.config["MAX_WORDS"] = 15

mail.init_app(app)

@app.route('/')
def form():
    return render_template('form_submit.html', maxwords=app.config["MAX_WORDS"])

@app.route('/contact', methods=['GET', 'POST'])
    logging.getLogger("sentry.errors.uncaught").setLevel(logging.CRITICAL)
else:
    sentry = None

app.before_request(redis_connect)

app.before_request(check_csrf_token)

app.after_request(set_cookie)
app.after_request(db_commit)

app.teardown_request(db_disconnect)
app.teardown_request(redis_disconnect)


app.config["MAIL_SERVER"] = os.environ.get("MAIL_SERVER", "localhost")
app.config["MAIL_PORT"] = int(os.environ.get("MAIL_PORT", 25))
app.config["MAIL_USE_TLS"] = "MAIL_USE_TLS" in os.environ
app.config["MAIL_USERNAME"] = os.environ.get("MAIL_USERNAME")
app.config["MAIL_PASSWORD"] = os.environ.get("MAIL_PASSWORD")
app.config["MAIL_SUPPRESS_SEND"] = app.testing or bool(os.environ.get("NOMAIL"))
mail = Mail(app)


# Views/routes

from newparp import views
from newparp.views import (
    account, admin, characters, chat, chat_api, chat_list, errors, guides,
    search, search_characters, settings,
)
Beispiel #3
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
Beispiel #4
0
stripe_keys = {
	'secret_key' : '',
	'publishable_key' : ''
}

stripe.api_key = stripe_keys['secret_key']

mail = Mail()

app = Flask(__name__)
sslify = SSLify(app)

app.secret_key = ""

app.config["MAIL_SERVER"] = "smtp.mailgun.org"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = ""
app.config["MAIL_PASSWORD"] = ""

mail.init_app(app)



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

@app.route('/about')
def about():
Beispiel #5
0
import wikipedia
from werkzeug.security import generate_password_hash, check_password_hash

mail = Mail()

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

app.config['SQLALCHEMY_DATABASE_URI'] = settings.database_uri
db = SQLAlchemy(app)

app.secret_key = settings.app_secret_key

# Mail config

app.config["MAIL_SERVER"] = settings.mail['server']
app.config["MAIL_PORT"] = settings.mail['port']
app.config["MAIL_USE_SSL"] = settings.mail['use_ssl']
app.config["MAIL_USERNAME"] = settings.mail['username']
app.config["MAIL_PASSWORD"] = settings.mail['password']

mail.init_app(app)


# Database Setup


class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    email = db.Column(db.String(120), unique=True)
    password = db.Column(db.String(100))
Beispiel #6
0
def create_app(configfile=None):
    app = Flask(__name__)
    handler = RotatingFileHandler("urlabuse.log", maxBytes=10000, backupCount=5)
    handler.setFormatter(Formatter("%(asctime)s %(message)s"))
    app.wsgi_app = ReverseProxied(app.wsgi_app)
    app.logger.addHandler(handler)
    app.logger.setLevel(logging.INFO)
    Bootstrap(app)
    q = Queue(connection=conn)

    # Mail Config
    app.config["MAIL_SERVER"] = "localhost"
    app.config["MAIL_PORT"] = 25
    mail = Mail(app)

    app.config["SECRET_KEY"] = "devkey"
    app.config["BOOTSTRAP_SERVE_LOCAL"] = True
    app.config["configfile"] = config_path

    parser = configparser.SafeConfigParser()
    parser.read(app.config["configfile"])

    replacelist = make_dict(parser, "replacelist")
    auth_users = prepare_auth()
    ignorelist = [i.strip() for i in parser.get("abuse", "ignore").split("\n") if len(i.strip()) > 0]
    autosend_threshold = 5

    def _get_user_ip(request):
        ip = request.headers.get("X-Forwarded-For")
        if ip is None:
            ip = request.remote_addr
        return ip

    @app.route("/", methods=["GET", "POST"])
    def index():
        form = URLForm()
        return render_template("index.html", form=form)

    @app.route("/urlreport", methods=["GET"])
    def url_report():
        return render_template("url-report.html")

    @app.errorhandler(404)
    def page_not_found(e):
        ip = request.headers.get("X-Forwarded-For")
        if ip is None:
            ip = request.remote_addr
        if request.path != "/_result/":
            app.logger.info("404 of {} on {}".format(ip, request.path))
        return render_template("404.html"), 404

    def authenticate():
        """Sends a 401 response that enables basic auth"""
        return Response(
            "Could not verify your access level for that URL.\n" "You have to login with proper credentials",
            401,
            {"WWW-Authenticate": 'Basic realm="Login Required"'},
        )

    def check_auth(username, password):
        """This function is called to check if a username /
        password combination is valid.
        """
        if auth_users is None:
            return False
        else:
            db_pass = auth_users.get(username)
            return db_pass == password

    @app.route("/login", methods=["GET", "POST"])
    def login():
        auth = request.authorization
        if not auth or not check_auth(auth.username, auth.password):
            return authenticate()
        return redirect(url_for("index"))

    @app.route("/_result/<job_key>", methods=["GET"])
    def check_valid(job_key):
        if job_key is None:
            return json.dumps(None), 200
        job = Job.fetch(job_key, connection=conn)
        if job.is_finished:
            return json.dumps(job.result), 200
        else:
            return json.dumps("Nay!"), 202

    @app.route("/start", methods=["POST"])
    def run_query():
        data = json.loads(request.data)
        url = data["url"]
        ip = _get_user_ip(request)
        app.logger.info("{} {}".format(ip, url))
        if get_submissions(url) >= autosend_threshold:
            send(url, "", True)
        is_valid = q.enqueue_call(func=is_valid_url, args=(url,), result_ttl=500)
        return is_valid.get_id()

    @app.route("/urls", methods=["POST"])
    def urls():
        data = json.loads(request.data)
        url = data["url"]
        u = q.enqueue_call(func=url_list, args=(url,), result_ttl=500)
        return u.get_id()

    @app.route("/resolve", methods=["POST"])
    def resolve():
        data = json.loads(request.data)
        url = data["url"]
        u = q.enqueue_call(func=dns_resolve, args=(url,), result_ttl=500)
        return u.get_id()

    @app.route("/phishtank", methods=["POST"])
    def phishtank():
        data = json.loads(request.data)
        if not os.path.exists("phishtank.key"):
            return None
        url = parser.get("PHISHTANK", "url")
        key = open("phishtank.key", "r").readline().strip()
        query = data["query"]
        u = q.enqueue_call(func=phish_query, args=(url, key, query), result_ttl=500)
        return u.get_id()

    @app.route("/virustotal_report", methods=["POST"])
    def vt():
        data = json.loads(request.data)
        if not os.path.exists("virustotal.key"):
            return None
        url = parser.get("VIRUSTOTAL", "url_report")
        url_up = parser.get("VIRUSTOTAL", "url_upload")
        key = open("virustotal.key", "r").readline().strip()
        query = data["query"]
        u = q.enqueue_call(func=vt_query_url, args=(url, url_up, key, query), result_ttl=500)
        return u.get_id()

    @app.route("/googlesafebrowsing", methods=["POST"])
    def gsb():
        data = json.loads(request.data)
        if not os.path.exists("googlesafebrowsing.key"):
            return None
        url = parser.get("GOOGLESAFEBROWSING", "url")
        key = open("googlesafebrowsing.key", "r").readline().strip()
        url = url.format(key)
        query = data["query"]
        u = q.enqueue_call(func=gsb_query, args=(url, query), result_ttl=500)
        return u.get_id()

    @app.route("/urlquery", methods=["POST"])
    def urlquery():
        data = json.loads(request.data)
        if not os.path.exists("urlquery.key"):
            return None
        url = parser.get("URLQUERY", "url")
        key = open("urlquery.key", "r").readline().strip()
        query = data["query"]
        u = q.enqueue_call(func=urlquery_query, args=(url, key, query), result_ttl=500)
        return u.get_id()

    @app.route("/ticket", methods=["POST"])
    def ticket():
        if not request.authorization:
            return ""
        data = json.loads(request.data)
        server = parser.get("SPHINX", "server")
        port = int(parser.get("SPHINX", "port"))
        url = parser.get("ITS", "url")
        query = data["query"]
        u = q.enqueue_call(func=sphinxsearch, args=(server, port, url, query), result_ttl=500)
        return u.get_id()

    @app.route("/whois", methods=["POST"])
    def whoismail():
        if not request.authorization:
            return ""
        server = parser.get("WHOIS", "server")
        port = parser.getint("WHOIS", "port")
        data = json.loads(request.data)
        query = data["query"]
        u = q.enqueue_call(func=whois, args=(server, port, query, ignorelist, replacelist), result_ttl=500)
        return u.get_id()

    @app.route("/eupi", methods=["POST"])
    def eu():
        data = json.loads(request.data)
        if not os.path.exists("eupi.key"):
            return None
        url = parser.get("EUPI", "url")
        key = open("eupi.key", "r").readline().strip()
        query = data["query"]
        u = q.enqueue_call(func=eupi, args=(url, key, query), result_ttl=500)
        return u.get_id()

    @app.route("/pdnscircl", methods=["POST"])
    def dnscircl():
        url = parser.get("PDNS_CIRCL", "url")
        user, password = open("pdnscircl.key", "r").readlines()
        data = json.loads(request.data)
        query = data["query"]
        u = q.enqueue_call(func=pdnscircl, args=(url, user.strip(), password.strip(), query), result_ttl=500)
        return u.get_id()

    @app.route("/bgpranking", methods=["POST"])
    def bgpr():
        data = json.loads(request.data)
        query = data["query"]
        u = q.enqueue_call(func=bgpranking, args=(query,), result_ttl=500)
        return u.get_id()

    @app.route("/psslcircl", methods=["POST"])
    def sslcircl():
        url = parser.get("PSSL_CIRCL", "url")
        user, password = open("psslcircl.key", "r").readlines()
        data = json.loads(request.data)
        query = data["query"]
        u = q.enqueue_call(func=psslcircl, args=(url, user.strip(), password.strip(), query), result_ttl=500)
        return u.get_id()

    @app.route("/get_cache", methods=["POST"])
    def get_cache():
        data = json.loads(request.data)
        url = data["query"]
        data = cached(url)
        dumped = json.dumps(data, sort_keys=True, indent=4, separators=(",", ": "))
        return dumped

    def digest(data):
        to_return = ""
        all_mails = set()
        for entry in data:
            for url, info in list(entry.items()):
                to_return += "\n{}\n".format(url)
                if info.get("whois"):
                    all_mails.update(info.get("whois"))
                    to_return += "\tContacts: {}\n".format(", ".join(info.get("whois")))
                if info.get("vt") and len(info.get("vt")) == 4:
                    vtstuff = info.get("vt")
                    to_return += "\t{} out of {} positive detections in VT - {}\n".format(
                        vtstuff[2], vtstuff[3], vtstuff[1]
                    )
                if info.get("gsb"):
                    to_return += "\tKnown as malicious on Google Safe Browsing: {}\n".format(info.get("gsb"))
                if info.get("phishtank"):
                    to_return += "\tKnown as malicious on PhishTank\n"
                if info.get("dns"):
                    ipv4, ipv6 = info.get("dns")
                    if ipv4 is not None:
                        for ip in ipv4:
                            to_return += "\t" + ip + "\n"
                            data = info[ip]
                            if data.get("bgp"):
                                to_return += "\t\t(PTR: {}) is announced by {} ({}).\n".format(*(data.get("bgp")[:3]))
                            if data.get("whois"):
                                all_mails.update(data.get("whois"))
                                to_return += "\t\tContacts: {}\n".format(", ".join(data.get("whois")))
                    if ipv6 is not None:
                        for ip in ipv6:
                            to_return += "\t" + ip + "\n"
                            data = info[ip]
                            if data.get("whois"):
                                all_mails.update(data.get("whois"))
                                to_return += "\t\tContacts: {}\n".format(", ".join(data.get("whois")))
            to_return += "\tAll contacts: {}\n".format(", ".join(all_mails))
        return to_return

    def send(url, ip="", autosend=False):
        if not get_mail_sent(url):
            set_mail_sent(url)
            data = cached(url)
            if not autosend:
                subject = "URL Abuse report from " + ip
            else:
                subject = "URL Abuse report sent automatically"
            msg = Message(subject, sender="urlabuse@circl.lu", recipients=["info@circl.lu"])
            msg.body = digest(data)
            msg.body += "\n\n"
            msg.body += json.dumps(data, sort_keys=True, indent=4, separators=(",", ": "))
            mail.send(msg)

    @app.route("/submit", methods=["POST"])
    def send_mail():
        data = json.loads(request.data)
        url = data["url"]
        if not get_mail_sent(url):
            ip = _get_user_ip(request)
            send(url, ip)
        return redirect(url_for("index"))

    return app
Beispiel #7
0
import stripe

stripe_keys = {
    'secret_key': os.environ['SECRET_KEY'],
    'publishable_key': os.environ['PUBLISHABLE_KEY']
}

stripe.api_key = stripe_keys['secret_key']

app = Flask(__name__)
heroku = Heroku(app)

#need to explicity define the mail gun smtp port since flask_heroku
#leaves this out

app.config["MAIL_SERVER"] = os.environ["MAILGUN_SMTP_SERVER"]
app.config['MAIL_PORT'] = os.environ["MAILGUN_SMTP_PORT"]
app.config['MAIL_USE_TLS'] = True
app.config['MAIL_USERNAME'] = os.environ["MAILGUN_SMTP_LOGIN"]
app.config['MAIL_PASSWORD'] = os.environ["MAILGUN_SMTP_PASSWORD"]

mail = Mail(app)

app.config["MONGODB_USERNAME"] = app.config['MONGODB_USER'] #flask_heroku naming convention mismatch, with MongoEngine this time
db = MongoEngine(app)

if not 'Production' in os.environ:
    app.debug = True
    from flask_cake import Cake
    cake = Cake(app, ["build"]) #this converts our coffeescript to javascript
    from flask.ext.less import LESS
Beispiel #8
0
# Create application
app = Flask(__name__)
app.config['SECRET_KEY'] = '123456790'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///fground.sqlite'
app.config['SQLALCHEMY_ECHO'] = True
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_USE_SSL"] = 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):
Beispiel #9
0
#!/bin/env python

# Author Balbir Singh <balbir@aol.in>
# Date 15th September 2015


from flask import Flask
from flask.ext.mail import Mail, Message

app = Flask(__name__)
mail = Mail(app)

app.config["MAIL_SERVER"] = "email-smtp.us-east-1.amazonaws.com"
app.config["MAIL_PORT"] = 587
app.config["MAIL_USE_TLS"] = True
app.config["MAIL_USERNAME"] = "AKIAIWW4MPBTQP3K26VQ"
app.config["MAIL_PASSWORD"] = "AnPrQHdi8lUpmSNJQbfn8IYLpilti82gx73L7yTSkM4f"
app.config["FLASKY_MAIL_SUBJECT_PREFIX"] = "[Flasky]"
app.config["FLASKY_MAIL_SENDER"] = "Flasky Admin <flasky@goeuro.me>"
app.config["FLASKY_ADMIN"] = "balbir97@gmail.com"

msg = Message("test subject", sender="you@goeuro.me", recipients=["balbir97@gmail.com"])
msg.body = "text body"
msg.html = "<b>HTML</b> body"

with app.app_context():
    mail.send(msg)
import os
from flask import Flask, Response
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.mail import Mail
from itsdangerous import URLSafeTimedSerializer

#Create an Instance of Flask
app = Flask(__name__)

#Include config from config.py
app.config.from_object('config')
app.config['UPLOAD_FOLDER'] = 'app/static/img/'
app.config['ALLOWED_EXTENSIONS'] = set(['png', 'jpg', 'jpeg', 'csv'])
app.config['WTF_CSRF_SECRET_KEY'] = '1234'
app.config["MAIL_SERVER"] = "mail.car.loc"
app.config["MAIL_PORT"] = 25
app.config["MAIL_USE_SSL"] = False
app.config["MAIL_USERNAME"] = None
app.config["MAIL_PASSWORD"] = None
app.secret_key = "1234"
app.config["SECURITY_PASSWORD_SALT"] = '1234'
app.config["POSTS_PER_PAGE"] = 10

#Create an instance of SQLAclhemy
db = SQLAlchemy(app)

mail = Mail(app)

login_manager = LoginManager()
login_manager.init_app(app)
Beispiel #11
0
#e = create_engine("mysql://firsvat:Firsvat@2016@98.102.204.204:3306/firsvat", pool_recycle=3600)

app = Flask(__name__)
app.secret_key = "moyinoluwa1999"

def ensure_dir(d):

    if not os.path.exists(d):

        os.makedirs(d)

app.config['SQLALCHEMY_POOL_SIZE'] = 100
app.config['SQLALCHEMY_POOL_RECYCLE'] = 280
app.config['UPLOAD_FOLDER'] = 'uploads/'
app.config["MAIL_SERVER"] = "smtp.pepipost.com"
app.config["MAIL_PORT"] = 25
#app.config["MAIL_USE_TLS"] = True
#app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = "guest"
app.config["MAIL_PASSWORD"] = "FunmiFatimo"
app.config["DEFAULT_MAIL_SUBJECT"] = "SinLimites"
app.config["DEFAULT_MAIL_SENDER"] = "SinLimites<no-reply@sci.ng>"
##app.config['UPLOAD_FOLDER'] = 'http://crestovista.com/guest-admin/www/img/'
CORS(app)

mail = Mail(app)

manager = APIManager(app,flask_sqlalchemy_db=db)

Beispiel #12
0
from flask.ext.wtf import Form
from wtforms import StringField, SubmitField
from wtforms.validators import Required
import os
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.mail import Mail
from flask.ext.mail import Message


basedir = os.path.abspath(os.path.dirname(__file__))
app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + os.path.join(basedir, "data.sqlite")
app.config["SQLALCHEMY_COMMIT_ON_TEARDOWN"] = True
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = True
app.config["SECRET_KEY"] = "hard to guess string"
app.config["MAIL_SERVER"] = "hyperion.com"
app.config["MAIL_PORT"] = "25"
app.config["FLASK_MAIL_SENDER"] = "hyperion@hyperion.com"
# app.config['MAIL_USERNAME']=
# app.config['MAIL_PASSWORD']=
app.config["FLASK_ADMIN"] = "hyperion@hyperion.com"
db = SQLAlchemy(app)

manager = Manager(app)
bootstrap = Bootstrap(app)
moment = Moment(app)
migrate = Migrate(app, db)
manager.add_command("db", MigrateCommand)
mail = Mail(app)

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 = 'secretpanda7781'
 
app.config["MAIL_SERVER"] = "send.one.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = 'contact@kristenhuber.com'
app.config["MAIL_PASSWORD"] = 'whiteRabbit7781'
 
mail.init_app(app)

@app.route('/contact', methods=['GET', 'POST'])
def contact():
  form = ContactForm()
 
  if request.method == 'POST':
    msg = Message(form.subject.data, sender='contact@kristenhuber.com', recipients=['kristen.huber.19@gmail.com'])
    msg.body = """
    From: %s &lt;%s&gt;
    %s
    """ % (form.name.data, form.email.data, form.message.data)
    mail.send(msg)
    return render_template('contact.html', success=True)
 
Beispiel #14
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'  # Puede ser cualquier cosa (un string)

app.config["MAIL_SERVER"] = "mail.riverdots.com"
app.config["MAIL_PORT"] = 25
app.config["MAIL_USE_SSL"] = False
app.config["MAIL_USERNAME"] = "pruebas@riverdots.com"
app.config["MAIL_PASSWORD"] = "123456"

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():
    form = ContactForm()

    if request.method == 'POST':
Beispiel #15
0
# rsvp_app.config.from_object('settings')  # Load from settings.py module

try:
    from settings_local import MAIL_SERVER
    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
Beispiel #16
0
import os
from flask import Flask, request, render_template
from flask.ext.assets import Environment, Bundle
from flask_mail import Mail

app = Flask(__name__)
assets = Environment(app)

app.config["MAIL_SERVER"] = ""
app.config["MAIL_PORT"] = ""
app.config["MAIL_USE_SSL"] = ""
app.config["MAIL_USERNAME"] = ""
app.config["MAIL_PASSWORD"] = ""

app.config.from_pyfile("config_mail.cfg")

mail = Mail(app)

from darts.controllers import api
from darts.controllers import brackets
from darts.controllers import matches
from darts.controllers import leaderboard
from darts.controllers import main
from darts.controllers import players
from darts.controllers import mark_styles

from darts.controllers.modes import cricket
from darts.controllers.modes import x01
from darts.controllers.modes import around_the_world

@app.errorhandler(404)
Beispiel #17
0
# coding:utf-8

import os

# import ipdb
from flask.ext.mail import Mail
from flask.ext.mail import Message
from flask import Flask, render_template

app = Flask(__name__)

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_PASSWORD"] = os.environ.get("MAIL_PASSWORD")
app.config["FLASK_MAIL_SUBJECT_PREFIX"] = "Lilium Accounts"
app.config["FLASKY_MAIL_SENDER"] = "1372488211@qq.com"

mail = Mail(app)


# todo, 发送邮件找回密码
# def send_email(to, subject, template, **kwargs):
def send_email(to_email, body):
    msg = Message(
        app.config["FLASK_MAIL_SUBJECT_PREFIX"], sender=app.config["FLASKY_MAIL_SENDER"], recipients=[to_email]
    )
    # msg.body=render_template(template+'.txt',**kwargs)
    # msg.html=render_template(template+'.html',**kwargs)
    msg.body = "text body"
Beispiel #18
0
from flask import Flask, g
from flask.ext.sqlalchemy import SQLAlchemy
import sqlite3
import os
 
app = Flask(__name__)
 
app.secret_key = 'development key'
 
app.config["MAIL_SERVER"] = "smtp.mail.yahoo.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = 'igoriaustin@yahoo.com'
app.config["MAIL_PASSWORD"] = 'efeosa'
 
from routes import mail
mail.init_app(app)

#DATABASE=os.path.join(app.root_path, 'testDB.db')
#DATABASE = 'testDB.db'
#DATABASE = 'C:/pythonvirtualenvironment/venv/app/database.db' 
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////app/new.db'
 
from models import db
db.init_app(app) 

import intro_to_flask.routes

#pp :igoriaustin@yahoo.com
Beispiel #19
0
from flask.ext.login import LoginManager

login_manager = LoginManager()
login_manager.init_app(app)


#####################################
## Mail
#####################################
if RUNTIME_ENV in ("bae",):
    from bae.api.bcms import BaeBcms

    BAE_BCMS = BaeBcms(const.ACCESS_KEY, const.SECRET_KEY)

elif RUNTIME_ENV in ("local",):
    app.config["MAIL_SERVER"] = "localhost"
    app.config["MAIL_PORT"] = 25
    app.config["MAIL_USE_TLS "] = False
    app.config["MAIL_USE_SSL "] = False
    app.config["MAIL_USERNAME "] = "test"
    app.config["MAIL_PASSWORD "] = "test"

    from flask_mail import Mail

    mail = Mail(app)

elif RUNTIME_ENV in ("gae", "gae_dev"):
    pass

#####################################
## Image Upload
Beispiel #20
0
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask_mail import Mail
from forms import LoginForm
from config import *


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

app.config["MAIL_SERVER"] = "192.168.1.223"
app.config["MAIL_PORT"] = "25"
app.config["MAIL_USERNAME"] = "s_int7"
app.config["MAIL_PASSWORD"] = "1234"
app.config["MAIL_USE_TLS"] = False
app.config["MAIL_USE_SSL"] = False
app.config["MAIL_DEBUG"] = True
app.config["DEFAULT_MAIL_SENDER"] = True

mail = Mail(app)
db = SQLAlchemy(app)

from app import views, models
Beispiel #21
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
Beispiel #22
0
import os
from functools import wraps
import json
from uuid import uuid4
import datetime
import smtplib

from flask import Response, redirect, Flask, request, flash, render_template
from flask_restful import Resource, Api, reqparse
from flask_mail import Mail, Message
from redis import StrictRedis


app = Flask(__name__)
app.debug = True if os.getenv("FLASK:DEBUG", False) == "True" else False
app.config["MAIL_SERVER"] = os.getenv("FLASK:EMAIL_HOST")
mail = Mail(app)
app.config["SECRET_KEY"] = "unused"
r = StrictRedis(host="db", port=6379, db=0)
parser = reqparse.RequestParser()
parser.add_argument("auth")


def check_auth(auth):
    """
    This function is called to check if the auth code is in the db.
    """
    return bool(r.hget("auth", auth))


def authenticate():