Closed palzuncoff closed 7 years ago
You also need to install social-auth-app-django
and add social.apps.django_app.default
to your INSTALLED_APPS in your settings.py file.
error changed
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/home/giverroot/django/gve1/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/home/giverroot/django/gve1/lib/python2.7/site-packages/django/core/management/__init__.py", line 341, in execute
django.setup()
File "/home/giverroot/django/gve1/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/giverroot/django/gve1/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/home/giverroot/django/gve1/lib/python2.7/site-packages/django/apps/config.py", line 199, in import_models
self.models_module = import_module(models_module_name)
File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/giverroot/django/gve1/lib/python2.7/site-packages/social/apps/django_app/default/models.py", line 1, in <module>
from social_django.models import AbstractUserSocialAuth, UserSocialAuth, Nonce, Association, Code, DjangoStorage
File "/home/giverroot/django/gve1/lib/python2.7/site-packages/social_django/models.py", line 68, in <module>
class UserSocialAuth(AbstractUserSocialAuth):
File "/home/giverroot/django/gve1/lib/python2.7/site-packages/django/db/models/base.py", line 113, in __new__
"INSTALLED_APPS." % (module, name)
RuntimeError: Model class social_django.models.UserSocialAuth doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
@palzuncoff
As for Dec 03 2016, this library is now deprecated.
You should be using the new social-app-django.
Check out how to use that in this doc: https://github.com/omab/python-social-auth/blob/master/MIGRATING_TO_SOCIAL.md
Thank you
Somebody on #550 experienced the same troubles.
hi,how did you sloved it? the second fault.
ok, i know how to fix it,thx.and by the way.i have spell the wrong word 'solves',ha ha
I'm now encountering an error, it says ImportError at / cannot import name engines it traced back to /lib/python2.7/site-packages/social_django/strategy.py in this line from django.template import TemplateDoesNotExist, RequestContext, loader, engines
@fendyh what's your django version? Is django installed in your env (virtual or not)? What happens if you run from django.template import engines
in a python shell within it?
@omab My Django version is 1.7.3 , and yes from django.template import engines
generates error as it does not exist, what Django version should I use ? And yes My Django is installed in virtualenv
Thank you for the answer!
@omab I've tried upgrading my Django to the newest version and it generates so much errors, I think changing my Django version is not an option
@fendyh, PSA is dropping support for Django <= 1.7
, I do recommend updating at least to 1.8, or stick with PSA version 0.2.21
Ok.
You need to have your INSTALLED_APPS like:
'social_django', 'social.apps.django_app.default',
Thanks for the answers. I finally managed to implement it by installing Django Social Auth instead, as it still has support for Django 1.7.
@fendyh I do not recomment going back to django-social-out, that codebase was abandoned years ago and it's very outdated at the memoment. If you stick to python-social-auth==0.2.21
, you will have Django 1.7 support.
Thanks for the answer ! I followed your suggestion and try installing python-social-auth==0.2.21
instead. As I have already implemented django-social-auth==0.7.28
, I will need to migrate it to python-social-auth
, and so I followed the instructions laid in http://psa.matiasaguirre.net/docs/configuration/porting_from_dsa.html
, as it turns out, when I run manage.py runserver, there's a warning You have unapplied migrations; your app may not work properly until they are applied. Run 'python manage.py migrate' to apply them.
and so I run manage.py migrate
, and here's the result
Running migrations: Applying social_auth.0001_initial...Traceback (most recent call last): File "./manage.py", line 10, in <module> ... django.db.utils.ProgrammingError: relation "social_auth_association" already exists
can you help with this ? this maybe a newbie error, sorry but I'm new to Django, I don't know how to solve this, but thanks for helping !
Try with python manage.py migrate --fake
.
@omab Thanks for the answer ! the fake migration worked, and I can login and logout normally again. there's still an issue though, when I go to http://localhost:8000/admin/social_auth/usersocialauth/ , it generates an error `AttributeError at /admin/social_auth/usersocialauth/
'Options' object has no attribute 'get_fields'`
further stacktrace, the error generated originated from /titanium_toys_env/lib/python2.7/site-packages/social/apps/django_app/default/admin.py in get_search_fields, particularly this line: `
)
if search_fields is None:
_User = UserSocialAuth.user_model()
username = getattr(_User, 'USERNAME_FIELD', None) or \
hasattr(_User, 'username') and 'username' or \
None
fieldnames = ('first_name', 'last_name', 'email', username)
all_names = self._get_all_field_names(_User._meta) // this line generates the error
...
search_fields = [name for name in fieldnames
if name and name in all_names]
return ['user__' + name for name in search_fields]
@staticmethod
def _get_all_field_names(model):
`
thanks !!
I've fixed this in my project by doing the above mentioned steps and changing social_auth to social_django in my own migrations. There's probably a better way though
Could you please tell me, why I have install this packаge "social-auth-app-django" and why it does not work without it. Nothing is said in the docs about it. And I have rollback to version 0.2.21 because current version on pip does not work. It not return authorized user
@tytarenko you don't, you can stick with 0.2.21
or migrate to the new version that depends on the new packages, the library is now split in smaller modules, and anything >=0.3.0
will depend on the new packages.
Traceback (most recent call last):
File "manage.py", line 22, in
I have installed social-auth-app-django and added social.apps.django_app.default to INSTALLED_APPS in settings.py file.
please can someone help. I am getting this:
Unhandled exception in thread started by <function check_errors.
@Balance-Sun, that's not related to this project, please refer to the corresponding project.
When i tried makemigrations i take following error