I've hosted a python Flask project in AWS using uWSGI and Nginx, initially everything worked fine, but then I decided to implement Flask-admin module. Now page is showing me an Internal Server Error message.
I've checked UWSGI log and says:
Traceback (most recent call last):
File "/var/www/project/run.py", line 2, in <module>
from app import app
File "/var/www/project/app/__init__.py", line 22, in <module>
from app import views
File "/var/www/project/app/views.py", line 15, in <module>
from flask_admin.contrib.sqla import ModelView
File "/var/www/project/venv/local/lib/python2.7/site-packages/flask_admin/contrib/sqla/__init__.py", line 2, in <module>
from .view import ModelView
File "/var/www/project/venv/local/lib/python2.7/site-packages/flask_admin/contrib/sqla/view.py", line 17, in <module>
from flask_admin.contrib.sqla.tools import is_relationship
File "/var/www/project/venv/local/lib/python2.7/site-packages/flask_admin/contrib/sqla/tools.py", line 4, in <module>
from sqlalchemy.ext.declarative.clsregistry import _class_resolver
ImportError: cannot import name _class_resolver
Fri Nov 10 07:41:08 2017 - unable to load app 0 (mountpoint='project.domain.com|') (callable not found or import error)
Fri Nov 10 07:41:08 2017 - --- no python application found, check your startup logs for errors ---
My app/views.py imports are:
# -*- coding: utf-8 -*-
import os, time
from app import app
import flask
from flask import render_template, request, jsonify, send_from_directory, send_file, session, redirect, g, url_for, make_response, session, request
from flask_sqlalchemy import SQLAlchemy
from models import RequestsLog
import requests
import json
from app import db, appname
import flask_admin as admin
from flask_admin import Admin, helpers, expose
from flask_admin.contrib.sqla import ModelView
from flask_admin.contrib import sqla
I've hosted a python Flask project in AWS using uWSGI and Nginx, initially everything worked fine, but then I decided to implement Flask-admin module. Now page is showing me an Internal Server Error message.
I've checked UWSGI log and says:
My app/views.py imports are:
I've posted this question in stack overflow with more details: https://stackoverflow.com/questions/47223592/flask-admin-cannot-import-name-class-resolver-under-uwsgi-and-nginx
Thanks a lot for your help.