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

 

Reducing ubuntu disk space

I wanted to upgrade my system from Biolinux 7.0 to Ubuntu 13.10 and still keep all my biolinux packages like galaxy, biopython and etc …

http://www.omgubuntu.co.uk/2010/08/omg-5-five-ways-to-free-space-in-ubuntu

http://www.westernwillow.com/cms/blog/franco/reclaiming-disk-space-ubuntu-server

http://theopenhelp.com/2010/06/how-to-free-up-disk-space-in-ubuntu.html

http://askubuntu.com/questions/100004/how-can-i-free-space-from-a-massive-39-5gb-var-log-folder

Code:

sudo apt-get autoclean

sudo apt-get autoremove

sudo apt-get clean

Try to clean the cache using

sudo rm -rf /var/cache/apt/archives/*.deb

http://askubuntu.com/questions/39536/how-can-i-store-var-on-a-separate-partition

http://askubuntu.com/questions/32191/how-do-i-remove-cached-deb-files

raony@biolinux[raony] df -h [ 8:16AM]
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 19G 16G 1.5G 92% /

Filesystem Size Used Avail Use% Mounted on

/dev/sda5 19G 14G 3.5G 80% /

Filesystem Size Used Avail Use% Mounted on
/dev/sda5 19G 12G 5.8G 67% /