_FakeSignal对象没有属性'connect_via

时间:2019-07-24 22:08:03

标签: python flask

我正在尝试从Web访问我的flask应用程序,并且正在生成此错误,我已在pycharm中成功运行了该错误,但未收到此错误。但现在,它的部署即时通讯收到我不明白的错误。这是找不到闪烁器库的问题吗?我尝试安装它,但仍然遇到问题,请帮助 这是代码

from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy
from flask_security import Security, SQLAlchemyUserDatastore, \
    UserMixin, RoleMixin, login_required
from flask import request
import os
from flask import Flask, flash, request, redirect, url_for
from werkzeug.utils import secure_filename

UPLOAD_FOLDER = "web\\static\\Uploads\\"
ALLOWED_EXTENSIONS = {'csv'}
# Create app
app = Flask(__name__,
            static_url_path='',
            static_folder='web/static',
            template_folder='web/templates')
app.config['DEBUG'] = True
app.config['SECRET_KEY'] = '***********'
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://*****************'
app.config['SECURITY_PASSWORD_SALT'] = ******************
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER

# 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)
    name = db.Column(db.String(80), unique=True)
    description = db.Column(db.String(255))


class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    email = db.Column(db.String(255), unique=True)
    password = db.Column(db.String(255))
    active = db.Column(db.Boolean())
    confirmed_at = db.Column(db.DateTime())
    roles = db.relationship('Role', secondary=roles_users,
                            backref=db.backref('users', lazy='dynamic'))


def allowed_file(filename):
    return '.' in filename and \
           filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS

# Setup Flask-Security


user_datastore = SQLAlchemyUserDatastore(db, User, Role)
security = Security(app, user_datastore)

... rest of application


if __name__ == '__main__':
    app.run()
[Wed Jul 24 17:01:49.186776 2019] [wsgi:error] [pid 12492] /usr/local/lib/python2.7/dist-packages/flask_sqlalchemy/__init__.py:835: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True or False to suppress this warning.
[Wed Jul 24 17:01:49.187092 2019] [wsgi:error] [pid 12492]   'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and '
[Wed Jul 24 17:01:49.289928 2019] [wsgi:error] [pid 12492] [client 192.168.1.229:53089] mod_wsgi (pid=12492): Target WSGI script '/home/unblockgames/Documents/wsgi/internalflask.wsgi' cannot be loaded as Python module.
[Wed Jul 24 17:01:49.289998 2019] [wsgi:error] [pid 12492] [client 192.168.1.229:53089] mod_wsgi (pid=12492): Exception occurred processing WSGI script '/home/unblockgames/Documents/wsgi/internalflask.wsgi'.
[Wed Jul 24 17:01:49.290924 2019] [wsgi:error] [pid 12492] [client 192.168.1.229:53089] Traceback (most recent call last):
[Wed Jul 24 17:01:49.290967 2019] [wsgi:error] [pid 12492] [client 192.168.1.229:53089]   File "/home/unblockgames/Documents/wsgi/internalflask.wsgi", line 3, in <module>
[Wed Jul 24 17:01:49.291645 2019] [wsgi:error] [pid 12492] [client 192.168.1.229:53089]     from internalflask.app import app as application
[Wed Jul 24 17:01:49.291670 2019] [wsgi:error] [pid 12492] [client 192.168.1.229:53089]   File "/home/unblockgames/Documents/internalflask/app.py", line 57, in <module>
[Wed Jul 24 17:01:49.291973 2019] [wsgi:error] [pid 12492] [client 192.168.1.229:53089]     security = Security(app, user_datastore)
[Wed Jul 24 17:01:49.292008 2019] [wsgi:error] [pid 12492] [client 192.168.1.229:53089]   File "/usr/local/lib/python2.7/dist-packages/flask_security/core.py", line 469, in __init__
[Wed Jul 24 17:01:49.292037 2019] [wsgi:error] [pid 12492] [client 192.168.1.229:53089]     self._state = self.init_app(app, datastore, **kwargs)
[Wed Jul 24 17:01:49.292054 2019] [wsgi:error] [pid 12492] [client 192.168.1.229:53089]   File "/usr/local/lib/python2.7/dist-packages/flask_security/core.py", line 493, in init_app
[Wed Jul 24 17:01:49.292074 2019] [wsgi:error] [pid 12492] [client 192.168.1.229:53089]     identity_loaded.connect_via(app)(_on_identity_loaded)
[Wed Jul 24 17:01:49.292832 2019] [wsgi:error] [pid 12492] [client 192.168.1.229:53089] AttributeError: '_FakeSignal' object has no attribute 'connect_via'

0 个答案:

没有答案