コード例 #1
0
else:
    app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///./database/user.db'

app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['MAIL_SERVER'] = 'smtp.googlemail.com'
app.config['MAIL_PORT'] = 587
app.config['MAIL_USE_TLS'] = True
app.config['MAIL_USERNAME'] = configuration['gmail_username']
app.config['MAIL_PASSWORD'] = configuration['gmail_password']
app.config['FLASKY_MAIL_SUBJECT_PREFIX'] = '[Aula Virtual] '
app.config['FLASKY_MAIL_SENDER'] = 'Prof. Sol Famida'

print(app.config['SQLALCHEMY_DATABASE_URI'])

from mail import init_mail
mail = init_mail(app)

from flask_bootstrap import Bootstrap
Bootstrap(app)

from admin import init_admin
admin = init_admin(app)

# ORM - Object Relational Mapping -Magico que se conecta a casi cualquiera base de datos.
from models import init_db, User
db = init_db(app)

migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
コード例 #2
0
def send_mail():
    mail, msg = init_mail()
    msg = 'HELLO1'
    mail.send(msg)