Closed marianobrc closed 7 years ago
Hi,
I had followed the instructions given in the readme and even I'm facing this exact same error
AttributeError: type object 'Language' has no attribute '__table__'
Is there any workaround to this?
Also, Thank you for sharing this framework
Which python version are you using? Can you try the develop branch with python 3? A new version will be out soon.
I was using python3 and hit upon the same issue, I think I resolved the issue by adding initialising variable __table__ = 'Language' . I am not sure if this is the best fix to the problem as I would expect metadata initialisation to be handled in the abstract base class. Maybe I am wrong.
The problem is that the dependency versions are currently not pinned and an flask-admin update broke compatibility. A fix for that update, as well as version pinning will be introduced in v0.2.
To temporary fix the issue, you can edit setup.py in line 25 with with 'flask-admin==1.4.0'
I edited the setup.py file at line 25 but the issue is not resolved. I still get the same error.
Hi @sidgitind, I was also facing this similar issue, I uninstalled my flask admin and installed pip install flask-admin==1.4.0 and the issue was resolved. I am not well-versed with python so was not sure how the setup.py change would take into affect and hence did this. PS: also thanks to the team who made this gamification engine
I think I can close this here. It's fixed in the current develop-branch and a workaround has been found for the current master. New version will be out soon.
Hi, first of all Thanks for your hard work, and sharing your framework.
I'm trying to deploy the server and I'm having some errors. I hope you can give me some clues about what can be happening. Thanks in advance.
First i had to run:
alembic init
Then I've configured the database user and psw in production.ini, then I've run
initialize_gengine_db ./production.ini ./alembic.ini
After that I tried to run the server with
pserve production.ini
I got this error: /deploy/venv-gamification/local/lib/python2.7/site-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.admin.contrib.sqla is deprecated, use flask_admin.contrib.sqla instead. .format(x=modname), ExtDeprecationWarning Traceback (most recent call last): File "/deploy/venv-gamification/bin/pserve", line 11, in
sys.exit(main())
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 60, in main
return command.run()
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 371, in run
global_conf=vars)
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 406, in loadapp
return loadapp(app_spec, name=name, relative_to=relative_to, _kw)
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
return loadobj(APP, uri, name=name, _kw)
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
return context.create()
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
return self.object_type.invoke(self)
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
return fix_call(context.object, context.global_conf, _context.local_conf)
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/paste/deploy/util.py", line 55, in fix_call
val = callable(_args, _kw)
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/gengine/init.py", line 63, in main
secret=settings.get("flaskadmin_secret","fKY7kJ2xSrbPC5yieEjV"))
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/gengine/flaskadmin.py", line 81, in init_flaskadmin
admin.add_view(ModelViewTranslationVariable(DBSession, category="Rules"))
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/gengine/flaskadmin.py", line 106, in init
super(ModelViewTranslationVariable, self).init(TranslationVariable, session, *_kwargs)
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/flask_admin/contrib/sqla/view.py", line 318, in init
menu_icon_value=menu_icon_value)
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/flask_admin/model/base.py", line 771, in init
self._refresh_cache()
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/flask_admin/model/base.py", line 861, in _refresh_cache
self._refresh_forms_cache()
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/flask_admin/model/base.py", line 788, in _refresh_forms_cache
self._create_form_class = self.get_create_form()
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/flask_admin/model/base.py", line 1220, in get_create_form
return self.get_form()
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/flask_admin/model/base.py", line 1177, in get_form
return self.scaffold_form()
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/flask_admin/contrib/sqla/view.py", line 670, in scaffold_form
form_class = self.scaffold_inline_form_models(form_class)
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/flask_admin/contrib/sqla/view.py", line 706, in scaffold_inline_form_models
form_class = inline_converter.contribute(self.model, form_class, m)
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/flask_admin/contrib/sqla/form.py", line 610, in contribute
extra_fields=info.form_extra_fields)
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/flask_admin/contrib/sqla/form.py", line 436, in get_form
for name, p in properties:
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/flask_admin/contrib/sqla/form.py", line 431, in
properties = (find(x) for x in only)
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/flask_admin/contrib/sqla/form.py", line 417, in find
column, path = get_field_with_path(model, name)
File "/deploy/venv-gamification/local/lib/python2.7/site-packages/flask_admin/contrib/sqla/tools.py", line 150, in get_field_with_path
table = current_model.table
AttributeError: type object 'Language' has no attribute 'table'