Adding social authentication to site - django

Django==1.10.5. i have isntalled - pip install python-social-auth==0.2.12. Then addes social.apps.djang_app.default to the INSTALLED_APP settings. After wanted to sync python-social-auth model with Database
python projectname\manage.py migrate
But i got an error: AppRegistryNotReady:Apps aren't loaded yet

0.2.12 is outdated and the library itself is deprecated.
Consider trying newer version or switching to django-allauth instead.

Related

Django All Auth Google Login Prevent extra page

I have enabled google login in my Django web application. right now what happens is, when i click on login the url is as follows: it takes me to this page (please find the image below) which i want to prevent but can't figure out how do i.
here is the image
Please assist.
I have uninstalled Django-allauth using the following command :
pip uninstall django-allauth
After that I have installed an older version of that using:
pip install django-allauth==0.45
Then:
python manage.py makemigrations
pytthon manage.py migrate
Done. This solved the problem
This behavior was released in version 0.47.0:
Added a new setting SOCIALACCOUNT_LOGIN_ON_GET that controls whether or not the endpoints for initiating a social login (for example, “/accounts/google/login/”) require a POST request to initiate the handshake. As requiring a POST is more secure, the default of this new setting is False.
You can add the flag in your settings.py file to avoid the intermediate page:
SOCIALACCOUNT_LOGIN_ON_GET=True
And keep using the latest version of the library.

how to work with south in django

I am trying to learn about python-django web framework.
I have successfully installed database migration tool 'south' in my ubuntu os and also added it to INSTALLED_APPS for using this tool for my web app.
When I run any command using manage.py like
$ ./manage.py runserver
I get this error:
"/usr/local/lib/python2.7/dist-packages/South-1.0.2-py2.7.egg/south/db/generic.py:9: RemovedInDjango19Warning: The django.db.backends.util module has been renamed. Use django.db.backends.utils instead.
from django.db.backends.util import truncate_name
There is no South database module 'south.db.sqlite3' for your database. Please either choose a supported database, check for SOUTH_DATABASE_ADAPTER[S] settings, or remove South from INSTALLED_APPS."
I don't understand what it means. How can I fix this error?
Please give your useful suggestion to solve this error.Thanks
Firstly, you appear to be using the development version of Django. Don't do that, especially as you're just beginning. Use the latest actual release, 1.8.
Secondly, since 1.7 Django has included built-in migrations. There is no need to install South.

Can't start accounts app using django-userena

Tried to install django-userena, and when launching
python manage.py startapp polls
I get the userena.compat.SiteProfileNotAvailable error.
So this is very odd.
First of all, official Django docs claims to depricate AUTH_PROFILE_MODULE setting : https://docs.djangoproject.com/en/1.7/releases/1.7/.
But /usr/local/lib/python2.7/dist-packages/userena/utils.py raises this error if it can't find AUTH_PROFILE_MODULE setting. Does it mean I can't use userena unless I downgrade to versions 1.6 or lower?
Secondly, I haven't created any models yet, so which profile I should have been addressing when starting app?
Django version 1.7.7, userena - 1.4.0
I solved the problem by uninstalling userena, creating accounts app, editing accounts/models.py file and only then installing userena.
Worked out perfectly

Error with django-registration module: AppRegistryNotReady("Models aren't loaded yet.")

I am having a problem getting the Django registration module to work. I am relatively new to Django, having only worked through a few examples, now wanting to rebuild a site using user registration, that I've previously made with python.
I am using Python 2.7, Django 1.7.1, and my operating system is Ubuntu 14.04. I'm also using Eclipse/PyDev for my IDE.
I keep getting the error message:
raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
I have installed both the django-registration and django-registration-redux modules, understanding that there may issues with installing django-registration in Django 1.7. Should I copy the registration module directly into my app, although not advised, but for troubleshooting? Should I uninstall something before I install a new package?
The django-registration module resides in "/usr/local/lib/python2.7/dist-packages." I'm not sure where the django-registration-redux module should have ended up at, although it deposited "django_registration_redux-1.1.egg-info" with the dist-packages.
I have added 'registration', to the settings file, and to my urls' file pattern I've added: (r'^accounts/', include('registration.backends.default.urls')),
I've read numerous on-line postings about this issue, but I can't get around this block. Should I uninstall Django 1.7.1, and install Django 1.6 to avoid this impasse?
Thanks,
Walter Goedecke
Have you considered using django-allauth instead of django-registration?
As I understand it, django-registration is no longer being maintained.
Were you able to resolve this?
When you say “I have installed both the django-registration and django-registration-redux modules”, do you mean you are trying to use both at the same time, or you tried one and then the other? You should only be using django-registration-redux, I believe django-registration stopped being maintained during one of the Django 1.6 releases, maybe it was 1.5 don’t recall. If its of any help, we have Django 1.7.9, Django 1.8.1, and Django 1.8.3 working with django-registration-redux 1.1.
It sounds like you are installing your python packages system wide (you said its residing in /usr/local/lib/python2.7/dist-packages). There is a great tool called virtualenv that lets you keep all of your projects isolated, in their own virtual environment with their unique dependences. This way one project can be using django 1.5 while another is using django 1.7, one project can use django-registration-redux while the other uses allauth, etc. The other great thing about it, is that it makes your projects more portable, easier to share, and easier to update.
If you haven’t tried it yet, you should check it out!
http://docs.python-guide.org/en/latest/dev/virtualenvs/
I found this link very helpful when I was first getting started with Python and Django development:
http://www.jeffknupp.com/blog/2013/12/18/starting-a-django-16-project-the-right-way/

Do I need to uninstall Django 1.3 before installing Django-nonrel?

I want to use multiple databases in my Django project. I currently have Django 1.3 installed and my project uses PostgreSQL.
I want to add an app that uses MongoDB.
As I understand(please correct me if I'm wrong), to support MongoDB, I need Django-nonrel which is a fork that provides support for non-relational databases.
So what do I need to do to get MongoEngine running in my Django project while still keeping support for the Postgre stuff in my project?
Should I just run the setup.py in the Django-nonrel package? Uninstall the official Django 1.3? I'm confused here.
If you're using pip, I think it will do it for you automatically because nonrel marks itself as supplying "django".
You are correct that you will need to uninstall django and install django-nonrel if pip doesn't do that automatically.
As for the apps living on the same project, in your database dictionary you just set one db to use postgres and one to use mongo.
If you have any questions we are here at #django-nonrel on freenode irc.
best thing you can do is installing django non real on virtualenv
http://zcentric.com/2010/09/24/get-django-nonrel-working-with-virtualenv/
this way you can have both working together (don't need to uninstall django first)