- <virtualenv_name>
- bin
- include
- lib
- src
- documents
- requirements >>>>- - base.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Byte-compiled / optimized / DLL files | |
__pycache__/ | |
*.py[cod] | |
*$py.class | |
# C extensions | |
*.so | |
# Distribution / packaging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In any authentication related app create new file email_authentication_backends.py | |
from django.contrib.auth.models import User | |
from django.contrib.auth.backends import ModelBackend | |
class EmailAuthBackend(ModelBackend): | |
""" | |
Extends default django ModelBackend for both Email Authentication and Username | |
Authentication against settings.AUTH_USER_MODEL | |
i.e: user can login with either email or username. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import urllib2 | |
gh_url = 'https://api.github.com' | |
req = urllib2.Request(gh_url) | |
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#urls.py | |
""" | |
Django 1.9+ Pattern Syntax | |
""" | |
from blog.views import ( | |
ArticleView, | |
YearArchiveView, | |
MonthArchiveView, | |
PostSlugView, |
NewerOlder