我在发送烧瓶重置密码请求时遇到问题。 这是 init .py中用于设置电子邮件环境的代码
from flask import Flask, render_template,url_for,flash,redirect
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
from flask_login import LoginManager
from flask_mail import Mail
import os
app=Flask(__name__) #the name of the application package
app.config['SECRET_KEY']='88fe5c0981ba01f5b81bcdb8c12dad29'
app.config['SQLALCHEMY_DATABASE_URI']='sqlite:///site.db' #creates database in the pc location
db=SQLAlchemy(app)
bcrypt=Bcrypt(app)
login_manager=LoginManager(app)
login_manager.login_view='login'
login_manager.login_message_category='info'
app.config['MAIL_SERVER']='smtp.gmail.com'
app.config['MAIL_PORT']=587
app.config['MAIL_USE_TLS']=True
app.config['MAIL_USERNAME']=os.environ.get('NotifyEmail')
app.config['MAIL_PASSWORD']=os.environ.get('EMAIL_PASS')
mail=Mail(app)
from flaskdrip import routes
启动服务器后,即使为NotifyEmail和EMAIL_PASS设置了环境变量,我仍然收到此错误
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.