Django 1.5 User Model and Registration

Facebook Login

Sell stuff to your audience: https://gumroad.com/

https://github.com/omab/django-social-auth

https://github.com/jonathanendersby/SocialAuthCustomUserModel

Trying to get this one working!

pip install django-social-auth

django-admin.py startapp accounts

Add to settings:

‘genomex.accounts’,
‘social_auth’,

add to middleware classes

‘social_auth.middleware.SocialAuthExceptionMiddleware’,

Add to settings

AUTHENTICATION_BACKENDS = (
    ‘social_auth.backends.google.GoogleOAuth2Backend’,
    ‘django.contrib.auth.backends.ModelBackend’,
)
LOGIN_URL = ‘/’
LOGIN_REDIRECT_URL = ‘/post’
LOGIN_ERROR_URL = ‘/error’
GOOGLE_OAUTH2_CLIENT_ID = ‘CLIENTIDCLIENTIDCLIENTIDCLIENTID’
GOOGLE_OAUTH2_CLIENT_SECRET = ‘CLIENTSECRETCLIENTSECRETCLIENTSECRET’
AUTH_USER_MODEL = ‘myapp.User’ # You do not need SOCIAL_AUTH_USER_MODEL

Go to google api to get an id

https://code.google.com/apis/console/?pli=1#project:804861904040:access

Call back www.genomex.org/post

Add keys

Fill Models and Views, templates

add urls.py

 url(r”, include(‘social_auth.urls’)),
    url(r’^$’, TemplateView.as_view(template_name=”pre.html”)),
    url(r’^post$’, TemplateView.as_view(template_name=”post.html”)),
    url(r’^error$’, TemplateView.as_view(template_name=”error.html”)),
./manage.py syncdb

migrate

Fix templateview

Deploy!

Setting up env in Webfaction

https://github.com/xenith/django-base-template

$ pip install -r requirements/local.txt
$ cp projectname/settings/local-dist.py projectname/settings/local.py
$ python manage.py syncdb
$ python manage.py migrate
$ python manage.py runserver

Edit http apache confg

edit wsgi.py

from site import addsitedir
addsitedir(‘/home/raony/.virtualenvs/cursoder/lib/python2.7/site-packages’)

sys.path.append(‘/home/raony/webapps/cursoder/rcourse’)

requirements/local

requirements/production

Set up Database

python manage.py sync

St up local.py

Redirect uri request

http://genomex.org/complete/google-oauth2/

Found this website a long time ago

http://learn.hackerearth.com/

https://github.com/pennersr/django-allauth