Делаю все по пунктам как показано, и в ходе запуска веб приложения выдает вот такую ошибку, не могу понять в чем проблема?
from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import Column, Integer, String, DateTime
from flask_migrate import Migrate, MigrateCommand, Manager
from datetime import datetime
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import LoginManager, UserMixin, login_required
from flask_mail import Mail, Message
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///usersinfo.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'] = 'youmail@gmail.com'
app.config['MAIL_DEFAULT_SENDER'] = 'youmail@gmail.com'
app.config['MAIL_PASSWORD'] = 'password'
manager = Manager(app)
manager.add_command('db', MigrateCommand)
db = SQLAlchemy(app)
migrate = Migrate(app, db)
mail = Mail(app)
login_manager = LoginManager(app)
login_manager.login_view = 'login'
@login_manager.user_loader
def load_user(user_id):
return db.session.query(Users).get(user_id)
class Users(db.Model, UserMixin):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
username = Column(String(80), unique=True, nullable=False)
email = Column(String(100), unique=True, nullable=False)
password_hash = Column(String(80), nullable=False)
created_on = Column(DateTime(), default=datetime.utcnow)
updated_on = Column(DateTime(), default=datetime.utcnow, onupdate=datetime.utcnow)
def __repr__(self):
return "<{}:{}>".format(self.id, self.username)
def set_password(self, password):
self.password_hash = generate_password_hash(password)
def check_password(self, password):
return check_password_hash(self.password_hash, password)
db.create_all()
db.session.commit()
@app.route('/admin/')
@login_required
def admin():
return render_template('admin.html')
app.run(port=5001)
-------------------------------------------------------
Ошибка: C:\Users\user8\PycharmProjects\web>python start.py
Traceback (most recent call last):
File "start.py", line 19, in
manager = Manager(app)
TypeError: 'NoneType' object is not callable