烧瓶应用。
我尝试 joblib.load 并获取 AttributeError' ManyToOneClassifier' 。
但是我已经用类导入了所有模块。
如果我尝试将模块中的类加载到模块中,那么......再次出错。
但是当我在__ main __中加载它时,一切正常......当上传时, uwsgi 在我的__ main __中看不到任何内容。我是C#程序员(.NET,微软等等),与nginx& Linux操作系统。
from clf_service import app, classificator
from clf_service.classificator import ManyClassifier, ManyToOneClassifier
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.externals import joblib
from os import path
application = app
APP_ROOT = path.dirname(path.abspath(__file__))
print "Loading models"
app.model = joblib.load(path.join(APP_ROOT, "clf_service/static/ml/clf/model_vec_to_one.pkl"))
app.vec = joblib.load(path.join(APP_ROOT, "clf_service/static/ml/clf/vec_to_one.pkl"))
print "Done, we are ready!"
if __name__ == '__main__':
app.run(debug=False)
__ init __。py
from flask.ext.sqlalchemy import SQLAlchemy
from flask import Flask
application = Flask(__name__)
app = application
app.config.from_object('config')
db = SQLAlchemy(app)
from clf_service import views, models, classificator