Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flask example - missing relation 'social_auth_usersocialauth' #4

Closed
skakri opened this issue Mar 31, 2013 · 8 comments
Closed

Flask example - missing relation 'social_auth_usersocialauth' #4

skakri opened this issue Mar 31, 2013 · 8 comments

Comments

@skakri
Copy link

skakri commented Mar 31, 2013

I've followed both the tutorial and examples/flask_example but I keep getting error about missing social_auth_usersocialauth relation.

One thing I had to change in the sample was
Base.metadata.create_all(bind=Base)
(Base was missing Model) to
Base.metadata.create_all(bind=db.engine)

Traceback: https://gist.github.com/skakri/5282381

I haven't tried to set up relation manually (I'm not proficient in postgresql).

@omab
Copy link
Owner

omab commented Apr 1, 2013

Have you tried running python manage.py syncdb in the sample app? There's a manager command defined for that, I've just tried it with sqlite and postgresql and it worked as expected.

@skakri
Copy link
Author

skakri commented Apr 1, 2013

Yes I have. I'll clone python-social-auth repo and try to check if the problem persists (maybe there's a problem with my environment; I copied files by hand) and I'll get back to you.

@skakri
Copy link
Author

skakri commented Apr 1, 2013

Ok, it's kinda weird, if you clone from git repo - it works, but if you copy files by hand - there's no relation.

Steps made (I'm on Arch, python by default is python 3, so I have to call python2.7)

git clone https://github.com/omab/python-social-auth.git python-social-auth-test
cd python-social-auth-test/
sudo python2.7 setup.py install
cd examples/flask_example
pip2 install -r requirements.txt # failed, couldn't install flask to system wide flask-packages
sudo pip2 install -r requirements.txt
sudo pip2 install psycopg2
python2.7 ./manage.py syncdb
python2.7 ./manage.py runserver

(afterwards tried with postgre)
^ runs ok!

mkdir flask_example
cd flask_example
virtualenv-2.7 --python=/usr/bin/python2.7 --no-site-packages virtualenv
. virtualenv/bin/activate
pip install python-social-auth
# copying files from https://github.com/omab/python-social-auth/tree/master/examples/flask_example ...
wget https://raw.github.com/omab/python-social-auth/master/examples/flask_example/__init__.py
wget https://raw.github.com/omab/python-social-auth/master/examples/flask_example/manage.py
wget https://raw.github.com/omab/python-social-auth/master/examples/flask_example/requirements.txt
wget https://raw.github.com/omab/python-social-auth/master/examples/flask_example/settings.py
mkdir models && cd models
wget https://raw.github.com/omab/python-social-auth/master/examples/flask_example/models/__init__.py
wget https://raw.github.com/omab/python-social-auth/master/examples/flask_example/models/user.py
cd ..
mkdir routes && cd routes
wget https://raw.github.com/omab/python-social-auth/master/examples/flask_example/routes/__init__.py
wget https://raw.github.com/omab/python-social-auth/master/examples/flask_example/routes/main.py
cd ..
mkdir templates && cd templates
wget https://raw.github.com/omab/python-social-auth/master/examples/flask_example/templates/base.html
wget https://raw.github.com/omab/python-social-auth/master/examples/flask_example/templates/done.html
wget https://raw.github.com/omab/python-social-auth/master/examples/flask_example/templates/home.html
cd ..

pip install -r requirements.txt
python ./manage.py migrate run
python ./manage.py runserver

On http://localhost:5000/complete/..

OperationalError: (OperationalError) no such table: social_auth_usersocialauth u'SELECT social_auth_usersocialauth.id AS social_auth_usersocialauth_id, social_auth_usersocialauth.provider AS social_auth_usersocialauth_provider, social_auth_usersocialauth.uid AS social_auth_usersocialauth_uid, social_auth_usersocialauth.extra_data AS social_auth_usersocialauth_extra_data, social_auth_usersocialauth.user_id AS social_auth_usersocialauth_user_id \nFROM social_auth_usersocialauth \nWHERE social_auth_usersocialauth.uid = ? AND social_auth_usersocialauth.provider = ?\n LIMIT ? OFFSET ?' ('14276842', 'twitter', 1, 0)

Maybe Python-Social-Auth package (via pip) differs from git and I've forgotten some step?

@omab
Copy link
Owner

omab commented Apr 1, 2013

pip package differs (I'm waiting to finish the tests to make a new release), don't run python manage.py migrate run, use python manage.py syncdb.

@skakri
Copy link
Author

skakri commented Apr 1, 2013

Yeah but there's no syncdb command (in package which is provided via pip):

python ./manage.py syncdb
Command syncdb not found
  migrate    
  runserver  Runs the Flask development server i.e. app.run()
  shell      Runs a Python shell inside Flask application context.

So it's better to install via git for now (I'm not developing anything critical, I just want to keep up with the latest version, which works)? :)

@omab
Copy link
Owner

omab commented Apr 1, 2013

I've released v0.1.1 to pypi, could you try again?

@skakri
Copy link
Author

skakri commented Apr 1, 2013

Great, it works now. Thank you!

@omab
Copy link
Owner

omab commented Apr 1, 2013

No problem, I'm closing the issue, reopen if needed.

@omab omab closed this as completed Apr 1, 2013
jenkins-ks pushed a commit to nttks/python-social-auth that referenced this issue Mar 8, 2016
jenkins-ks pushed a commit to nttks/python-social-auth that referenced this issue Mar 8, 2016
jenkins-ks pushed a commit to nttks/python-social-auth that referenced this issue Aug 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants