xen / flask-project-template

Ready to ship big flask project template
MIT License
285 stars 94 forks source link

Make && Make run gives an error #6

Open cmdrDiscoCat opened 7 years ago

cmdrDiscoCat commented 7 years ago

The error is :

sqlalchemy.exc.InvalidRequestError: 
Class <class 'social.apps.flask_app.default.models.init_social.<locals>.UserSocialAuth'> does not have a __table__ or __tablename__ specified and does not inherit from an existing table-mapped class.
xen commented 7 years ago

Hello, can you please provide full traceback and with command used

cmdrDiscoCat commented 7 years ago

The make part runs ok but here it is.

[discocat@bbq-cat flask-project-template]$ make
if which virtualenv-2.7 >/dev/null; then virtualenv-2.7 venv; else virtualenv venv; fi
which: no virtualenv-2.7 in (/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/platform-tools:/opt/android-sdk/tools:/opt/android-sdk/tools/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
Using base prefix '/usr'
New python executable in /home/discocat/Project/flask-project-template/venv/bin/python3
Also creating executable in /home/discocat/Project/flask-project-template/venv/bin/python
Installing setuptools, pip, wheel...done.
. venv/bin/activate; pip install -Ur requirements.txt
Collecting Babel (from -r requirements.txt (line 2))
  Using cached Babel-2.4.0-py2.py3-none-any.whl
Collecting Flask (from -r requirements.txt (line 3))
  Downloading Flask-0.12.2-py2.py3-none-any.whl (83kB)
    100% |████████████████████████████████| 92kB 958kB/s 
Collecting Flask-Babel (from -r requirements.txt (line 4))
  Using cached Flask_Babel-0.11.2-py2.py3-none-any.whl
Collecting Flask-FlatPages (from -r requirements.txt (line 5))
  Using cached Flask_FlatPages-0.6-py2.py3-none-any.whl
Collecting Flask-Mail (from -r requirements.txt (line 6))
Collecting Flask-Script (from -r requirements.txt (line 7))
Collecting Flask-WTF (from -r requirements.txt (line 8))
  Using cached Flask_WTF-0.14.2-py2.py3-none-any.whl
Collecting Jinja2 (from -r requirements.txt (line 9))
  Using cached Jinja2-2.9.6-py2.py3-none-any.whl
Collecting Markdown (from -r requirements.txt (line 10))
Collecting PyYAML (from -r requirements.txt (line 11))
Collecting Werkzeug (from -r requirements.txt (line 12))
  Downloading Werkzeug-0.12.2-py2.py3-none-any.whl (312kB)
    100% |████████████████████████████████| 317kB 193kB/s 
Collecting itsdangerous (from -r requirements.txt (line 13))
Collecting requests (from -r requirements.txt (line 14))
  Downloading requests-2.17.3-py2.py3-none-any.whl (87kB)
    100% |████████████████████████████████| 92kB 574kB/s 
Collecting speaklater (from -r requirements.txt (line 15))
Collecting Flask-Cache (from -r requirements.txt (line 18))
Collecting pylibmc (from -r requirements.txt (line 19))
Collecting redis (from -r requirements.txt (line 20))
  Using cached redis-2.10.5-py2.py3-none-any.whl
Collecting celery (from -r requirements.txt (line 21))
  Using cached celery-4.0.2-py2.py3-none-any.whl
Collecting flask-restless (from -r requirements.txt (line 24))
Collecting Flask-SQLAlchemy (from -r requirements.txt (line 25))
  Using cached Flask_SQLAlchemy-2.2-py2.py3-none-any.whl
Collecting flask-migrate (from -r requirements.txt (line 26))
  Downloading Flask-Migrate-2.0.4.tar.gz
Collecting python_social_auth==0.2.1 (from -r requirements.txt (line 29))
Collecting Flask-Login (from -r requirements.txt (line 30))
  Using cached Flask_Login-0.4.0-py2.py3-none-any.whl
Collecting pytz>=0a (from Babel->-r requirements.txt (line 2))
  Using cached pytz-2017.2-py2.py3-none-any.whl
Collecting click>=2.0 (from Flask->-r requirements.txt (line 3))
  Using cached click-6.7-py2.py3-none-any.whl
Collecting blinker (from Flask-Mail->-r requirements.txt (line 6))
Collecting WTForms (from Flask-WTF->-r requirements.txt (line 8))
Collecting MarkupSafe>=0.23 (from Jinja2->-r requirements.txt (line 9))
Collecting urllib3<1.22,>=1.21.1 (from requests->-r requirements.txt (line 14))
  Downloading urllib3-1.21.1-py2.py3-none-any.whl (131kB)
    100% |████████████████████████████████| 133kB 160kB/s 
Collecting certifi>=2017.4.17 (from requests->-r requirements.txt (line 14))
  Downloading certifi-2017.4.17-py2.py3-none-any.whl (375kB)
    100% |████████████████████████████████| 378kB 648kB/s 
Collecting chardet<3.1.0,>=3.0.2 (from requests->-r requirements.txt (line 14))
  Downloading chardet-3.0.3-py2.py3-none-any.whl (133kB)
    100% |████████████████████████████████| 143kB 1.0MB/s 
Collecting idna<2.6,>=2.5 (from requests->-r requirements.txt (line 14))
  Downloading idna-2.5-py2.py3-none-any.whl (55kB)
    100% |████████████████████████████████| 61kB 1.4MB/s 
Collecting kombu<5.0,>=4.0.2 (from celery->-r requirements.txt (line 21))
  Using cached kombu-4.0.2-py2.py3-none-any.whl
Collecting billiard<3.6.0,>=3.5.0.2 (from celery->-r requirements.txt (line 21))
  Using cached billiard-3.5.0.2-py3-none-any.whl
Collecting sqlalchemy>=0.8 (from flask-restless->-r requirements.txt (line 24))
  Downloading SQLAlchemy-1.1.10.tar.gz (5.2MB)
    100% |████████████████████████████████| 5.2MB 225kB/s 
Collecting python-dateutil>2.0 (from flask-restless->-r requirements.txt (line 24))
  Using cached python_dateutil-2.6.0-py2.py3-none-any.whl
Collecting mimerender>=0.5.2 (from flask-restless->-r requirements.txt (line 24))
Collecting alembic>=0.6 (from flask-migrate->-r requirements.txt (line 26))
  Downloading alembic-0.9.2.tar.gz (986kB)
    100% |████████████████████████████████| 993kB 512kB/s 
Collecting six>=1.2.0 (from python_social_auth==0.2.1->-r requirements.txt (line 29))
  Using cached six-1.10.0-py2.py3-none-any.whl
Collecting PyJWT>=0.2.1 (from python_social_auth==0.2.1->-r requirements.txt (line 29))
  Downloading PyJWT-1.5.0-py2.py3-none-any.whl
Collecting oauthlib>=0.3.8 (from python_social_auth==0.2.1->-r requirements.txt (line 29))
Collecting requests-oauthlib<0.3.2,>=0.3.0 (from python_social_auth==0.2.1->-r requirements.txt (line 29))
Collecting python3-openid>=3.0.1 (from python_social_auth==0.2.1->-r requirements.txt (line 29))
  Using cached python3_openid-3.1.0-py3-none-any.whl
Collecting amqp<3.0,>=2.1.4 (from kombu<5.0,>=4.0.2->celery->-r requirements.txt (line 21))
  Using cached amqp-2.1.4-py2.py3-none-any.whl
Collecting python-mimeparse>=0.1.4 (from mimerender>=0.5.2->flask-restless->-r requirements.txt (line 24))
  Using cached python_mimeparse-1.6.0-py2.py3-none-any.whl
Collecting Mako (from alembic>=0.6->flask-migrate->-r requirements.txt (line 26))
Collecting python-editor>=0.3 (from alembic>=0.6->flask-migrate->-r requirements.txt (line 26))
Collecting defusedxml (from python3-openid>=3.0.1->python_social_auth==0.2.1->-r requirements.txt (line 29))
  Using cached defusedxml-0.5.0-py2.py3-none-any.whl
Collecting vine>=1.1.3 (from amqp<3.0,>=2.1.4->kombu<5.0,>=4.0.2->celery->-r requirements.txt (line 21))
  Using cached vine-1.1.3-py2.py3-none-any.whl
Building wheels for collected packages: flask-migrate, sqlalchemy, alembic
  Running setup.py bdist_wheel for flask-migrate ... done
  Stored in directory: /home/discocat/.cache/pip/wheels/7b/7d/90/1edd50fb951714143cbe1ffb1af3341e08d1d64084cd15cf41
  Running setup.py bdist_wheel for sqlalchemy ... done
  Stored in directory: /home/discocat/.cache/pip/wheels/40/56/d4/74f19c34f4828b433b6c15bbc77d8a21ddac1df3b7900d528a
  Running setup.py bdist_wheel for alembic ... done
  Stored in directory: /home/discocat/.cache/pip/wheels/b9/d5/8e/f0de6622033684ba94d029eabee5abda70b012db80bad13bd0
Successfully built flask-migrate sqlalchemy alembic
Installing collected packages: pytz, Babel, Werkzeug, itsdangerous, click, MarkupSafe, Jinja2, Flask, Flask-Babel, Markdown, PyYAML, Flask-FlatPages, blinker, Flask-Mail, Flask-Script, WTForms, Flask-WTF, urllib3, certifi, chardet, idna, requests, speaklater, Flask-Cache, pylibmc, redis, vine, amqp, kombu, billiard, celery, sqlalchemy, six, python-dateutil, python-mimeparse, mimerender, flask-restless, Flask-SQLAlchemy, Mako, python-editor, alembic, flask-migrate, PyJWT, oauthlib, requests-oauthlib, defusedxml, python3-openid, python-social-auth, Flask-Login
Successfully installed Babel-2.4.0 Flask-0.12.2 Flask-Babel-0.11.2 Flask-Cache-0.13.1 Flask-FlatPages-0.6 Flask-Login-0.4.0 Flask-Mail-0.9.1 Flask-SQLAlchemy-2.2 Flask-Script-2.0.5 Flask-WTF-0.14.2 Jinja2-2.9.6 Mako-1.0.6 Markdown-2.6.8 MarkupSafe-1.0 PyJWT-1.5.0 PyYAML-3.12 WTForms-2.1 Werkzeug-0.12.2 alembic-0.9.2 amqp-2.1.4 billiard-3.5.0.2 blinker-1.4 celery-4.0.2 certifi-2017.4.17 chardet-3.0.3 click-6.7 defusedxml-0.5.0 flask-migrate-2.0.4 flask-restless-0.17.0 idna-2.5 itsdangerous-0.24 kombu-4.0.2 mimerender-0.6.0 oauthlib-2.0.2 pylibmc-1.5.2 python-dateutil-2.6.0 python-editor-1.0.3 python-mimeparse-1.6.0 python-social-auth-0.2.1 python3-openid-3.1.0 pytz-2017.2 redis-2.10.5 requests-2.17.3 requests-oauthlib-0.3.1 six-1.10.0 speaklater-1.3 sqlalchemy-1.1.10 urllib3-1.21.1 vine-1.1.3
cd static && bower install
bower bootstrap#*               cached https://github.com/twbs/bootstrap.git#3.3.7
bower bootstrap#*             validate 3.3.7 against https://github.com/twbs/bootstrap.git#*
bower font-awesome#*            cached https://github.com/FortAwesome/Font-Awesome.git#4.7.0
bower font-awesome#*          validate 4.7.0 against https://github.com/FortAwesome/Font-Awesome.git#*
bower jquery#*                  cached https://github.com/jquery/jquery-dist.git#3.2.1
bower jquery#*                validate 3.2.1 against https://github.com/jquery/jquery-dist.git#*
bower jquery#1.9.1 - 3         install jquery#3.2.1
bower font-awesome#*           install font-awesome#4.7.0
bower bootstrap#*              install bootstrap#3.3.7

jquery#3.2.1 libs/jquery

font-awesome#4.7.0 libs/font-awesome

bootstrap#3.3.7 libs/bootstrap
└── jquery#3.2.1

The make returns an error though :

[discocat@bbq-cat flask-project-template]$ make run
. venv/bin/activate; python manage.py runserver -h 0.0.0.0 -d -r
/home/discocat/Project/flask-project-template/project/extensions.py:26: FlaskWTFDeprecationWarning: "flask_wtf.CsrfProtect" has been renamed to "CSRFProtect" and will be removed in 1.0.
  csrf = CsrfProtect()
/home/discocat/Project/flask-project-template/venv/lib/python3.6/site-packages/social/apps/flask_app/routes.py:2: ExtDeprecationWarning: Importing flask.ext.login is deprecated, use flask_login instead.
  from flask.ext.login import login_required, login_user
/home/discocat/Project/flask-project-template/venv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py:839: 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.
  'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and '
Traceback (most recent call last):
  File "manage.py", line 75, in <module>
    manager.run()
  File "/home/discocat/Project/flask-project-template/venv/lib/python3.6/site-packages/flask_script/__init__.py", line 412, in run
    result = self.handle(sys.argv[0], sys.argv[1:])
  File "/home/discocat/Project/flask-project-template/venv/lib/python3.6/site-packages/flask_script/__init__.py", line 383, in handle
    res = handle(*args, **config)
  File "/home/discocat/Project/flask-project-template/venv/lib/python3.6/site-packages/flask_script/__init__.py", line 156, in __call__
    app = app(**kwargs)
  File "/home/discocat/Project/flask-project-template/project/app.py", line 46, in create_app
    extensions_fabrics(app)
  File "/home/discocat/Project/flask-project-template/project/app.py", line 80, in extensions_fabrics
    init_social(app, db)
  File "/home/discocat/Project/flask-project-template/venv/lib/python3.6/site-packages/social/apps/flask_app/default/models.py", line 30, in init_social
    class UserSocialAuth(_AppSession, db.Model, SQLAlchemyUserMixin):
  File "/home/discocat/Project/flask-project-template/venv/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py", line 602, in __init__
    DeclarativeMeta.__init__(self, name, bases, d)
  File "/home/discocat/Project/flask-project-template/venv/lib/python3.6/site-packages/sqlalchemy/ext/declarative/api.py", line 64, in __init__
    _as_declarative(cls, classname, cls.__dict__)
  File "/home/discocat/Project/flask-project-template/venv/lib/python3.6/site-packages/sqlalchemy/ext/declarative/base.py", line 88, in _as_declarative
    _MapperConfig.setup_mapping(cls, classname, dict_)
  File "/home/discocat/Project/flask-project-template/venv/lib/python3.6/site-packages/sqlalchemy/ext/declarative/base.py", line 103, in setup_mapping
    cfg_cls(cls_, classname, dict_)
  File "/home/discocat/Project/flask-project-template/venv/lib/python3.6/site-packages/sqlalchemy/ext/declarative/base.py", line 133, in __init__
    self._setup_inheritance()
  File "/home/discocat/Project/flask-project-template/venv/lib/python3.6/site-packages/sqlalchemy/ext/declarative/base.py", line 430, in _setup_inheritance
    "table-mapped class." % cls
sqlalchemy.exc.InvalidRequestError: Class <class 'social.apps.flask_app.default.models.init_social.<locals>.UserSocialAuth'> does not have a __table__ or __tablename__ specified and does not inherit from an existing table-mapped class.
make: *** [Makefile:7: run] Error 1
chong commented 7 years ago

I got the same issues.

anmir commented 7 years ago

I've got the same issue. How to solve it?