Upgrade django-social-auth to python-social-auth
This commit is contained in:
parent
96fc8254ae
commit
40d5ac7e3a
8 changed files with 92 additions and 61 deletions
14
.pipignore
Normal file
14
.pipignore
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
flake8
|
||||||
|
pip-tools
|
||||||
|
ipdb
|
||||||
|
coverage
|
||||||
|
factory-boy
|
||||||
|
django-debug-toolbar
|
||||||
|
ipython
|
||||||
|
pep8
|
||||||
|
mock
|
||||||
|
unittest2
|
||||||
|
transifex-client
|
||||||
|
django-discover-runner
|
||||||
|
mccabe
|
||||||
|
pyflakes
|
2
fabfile.py
vendored
2
fabfile.py
vendored
|
@ -7,7 +7,7 @@ env.project_name = 'umap'
|
||||||
env.repository = 'https://yohanboniface@bitbucket.org/yohanboniface/umap.git'
|
env.repository = 'https://yohanboniface@bitbucket.org/yohanboniface/umap.git'
|
||||||
env.local_branch = 'master'
|
env.local_branch = 'master'
|
||||||
env.remote_ref = 'origin/master'
|
env.remote_ref = 'origin/master'
|
||||||
env.requirements_file = 'requirements.pip'
|
env.requirements_file = 'requirements.txt'
|
||||||
env.restart_sudo = False
|
env.restart_sudo = False
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
Django==1.5.5
|
|
||||||
South==0.7.6
|
|
||||||
django-leaflet-storage==0.5.0
|
|
||||||
django_compressor==1.2
|
|
||||||
django-social-auth==0.7.20
|
|
||||||
hg+https://bitbucket.org/liberation/sesql
|
|
||||||
Markdown==2.3.1
|
|
15
requirements.txt
Normal file
15
requirements.txt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
django-compressor==1.3
|
||||||
|
Django==1.5.5
|
||||||
|
GenericCache==1.0.2
|
||||||
|
httplib2==0.7.7
|
||||||
|
oauth2==1.5.211
|
||||||
|
oauthlib==0.6.1
|
||||||
|
Pillow==2.3.0
|
||||||
|
psycopg2==2.5.2
|
||||||
|
python-social-auth==0.1.22
|
||||||
|
requests-oauthlib==0.4.0
|
||||||
|
requests==2.2.1
|
||||||
|
simplejson==3.0.7
|
||||||
|
South==0.7.6
|
||||||
|
django-leaflet-storage==0.5.0
|
||||||
|
hg+https://bitbucket.org/liberation/sesql
|
|
@ -42,7 +42,7 @@ INSTALLED_APPS = (
|
||||||
'umap',
|
'umap',
|
||||||
'sesql',
|
'sesql',
|
||||||
'compressor',
|
'compressor',
|
||||||
'social_auth',
|
'social.apps.django_app.default',
|
||||||
|
|
||||||
'south',
|
'south',
|
||||||
|
|
||||||
|
@ -122,7 +122,8 @@ TEMPLATE_DIRS = (
|
||||||
|
|
||||||
TEMPLATE_CONTEXT_PROCESSORS += (
|
TEMPLATE_CONTEXT_PROCESSORS += (
|
||||||
'django.core.context_processors.request',
|
'django.core.context_processors.request',
|
||||||
'social_auth.context_processors.social_auth_backends',
|
'social.apps.django_app.context_processors.backends',
|
||||||
|
'social.apps.django_app.context_processors.login_redirect',
|
||||||
)
|
)
|
||||||
|
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
|
@ -158,18 +159,19 @@ MAP_SHORT_URL_NAME = "umap_short_url"
|
||||||
COMPRESS_ENABLED = True
|
COMPRESS_ENABLED = True
|
||||||
COMPRESS_OFFLINE = True
|
COMPRESS_OFFLINE = True
|
||||||
|
|
||||||
SOCIAL_AUTH_ASSOCIATE_URL_NAME = "associate_complete"
|
|
||||||
SOCIAL_AUTH_DEFAULT_USERNAME = lambda u: slugify(u)
|
SOCIAL_AUTH_DEFAULT_USERNAME = lambda u: slugify(u)
|
||||||
SOCIAL_AUTH_EXTRA_DATA = False
|
|
||||||
SOCIAL_AUTH_ASSOCIATE_BY_EMAIL = True
|
SOCIAL_AUTH_ASSOCIATE_BY_EMAIL = True
|
||||||
LOGIN_URL = "login"
|
LOGIN_URL = "login"
|
||||||
SOCIAL_AUTH_LOGIN_REDIRECT_URL = "/login/popup/end/"
|
SOCIAL_AUTH_LOGIN_REDIRECT_URL = "/login/popup/end/"
|
||||||
SOCIAL_AUTH_PIPELINE = (
|
SOCIAL_AUTH_PIPELINE = (
|
||||||
'social_auth.backends.pipeline.social.social_auth_user',
|
'social.pipeline.social_auth.social_details',
|
||||||
'social_auth.backends.pipeline.associate.associate_by_email',
|
'social.pipeline.social_auth.social_uid',
|
||||||
'social_auth.backends.pipeline.user.get_username',
|
'social.pipeline.social_auth.auth_allowed',
|
||||||
'social_auth.backends.pipeline.user.create_user',
|
'social.pipeline.social_auth.social_user',
|
||||||
'social_auth.backends.pipeline.social.associate_user',
|
'social.pipeline.social_auth.associate_by_email',
|
||||||
'social_auth.backends.pipeline.social.load_extra_data',
|
'social.pipeline.user.get_username',
|
||||||
'social_auth.backends.pipeline.user.update_user_details'
|
'social.pipeline.user.create_user',
|
||||||
)
|
'social.pipeline.social_auth.associate_user',
|
||||||
|
'social.pipeline.social_auth.load_extra_data',
|
||||||
|
'social.pipeline.user.user_details'
|
||||||
|
)
|
||||||
|
|
|
@ -8,11 +8,14 @@ it to umap/settings/local.py. It should not be checked into
|
||||||
your code repository.
|
your code repository.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from umap.settings.base import * # pylint: disable=W0614,W0401
|
from umap.settings.base import * # pylint: disable=W0614,W0401
|
||||||
|
|
||||||
SECRET_KEY = 'your secret key here'
|
SECRET_KEY = ''
|
||||||
|
INTERNAL_IPS = ('127.0.0.1', )
|
||||||
|
ALLOWED_HOSTS = ['*', ]
|
||||||
|
|
||||||
DEBUG = True # False in production
|
DEBUG = True
|
||||||
TEMPLATE_DEBUG = DEBUG
|
TEMPLATE_DEBUG = DEBUG
|
||||||
|
|
||||||
ADMINS = (
|
ADMINS = (
|
||||||
|
@ -20,14 +23,6 @@ ADMINS = (
|
||||||
)
|
)
|
||||||
MANAGERS = ADMINS
|
MANAGERS = ADMINS
|
||||||
|
|
||||||
# ALLOWED_HOST required by Django >= 1.5
|
|
||||||
# Should be set to your domain name, see:
|
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-ALLOWED_HOSTS
|
|
||||||
# Don't use "*" in production!
|
|
||||||
ALLOWED_HOSTS = [
|
|
||||||
'*',
|
|
||||||
]
|
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.contrib.gis.db.backends.postgis',
|
'ENGINE': 'django.contrib.gis.db.backends.postgis',
|
||||||
|
@ -37,36 +32,48 @@ DATABASES = {
|
||||||
|
|
||||||
WSGI_APPLICATION = 'umap.wsgi.application'
|
WSGI_APPLICATION = 'umap.wsgi.application'
|
||||||
|
|
||||||
COMPRESS_ENABLED = False # True in production
|
COMPRESS_ENABLED = False
|
||||||
COMPRESS_OFFLINE = True
|
COMPRESS_OFFLINE = True
|
||||||
|
|
||||||
LANGUAGE_CODE = 'en'
|
LANGUAGE_CODE = 'en'
|
||||||
LANGUAGES = (
|
|
||||||
('en', 'English'),
|
|
||||||
('fr', u'Francais'),
|
|
||||||
('it', u'Italiano'),
|
|
||||||
('pt', u'Portuguese'),
|
|
||||||
('nl', u'Dutch'),
|
|
||||||
)
|
|
||||||
|
|
||||||
AUTHENTICATION_BACKENDS = (
|
AUTHENTICATION_BACKENDS = (
|
||||||
'social_auth.backends.contrib.github.GithubBackend',
|
'social.backends.github.GithubOAuth2',
|
||||||
'social_auth.backends.contrib.bitbucket.BitbucketBackend',
|
'social.backends.bitbucket.BitbucketOAuth',
|
||||||
'social_auth.backends.twitter.TwitterBackend',
|
'social.backends.twitter.TwitterOAuth',
|
||||||
'umap.osm_backend.OSMBackend',
|
'social.backends.openstreetmap.OpenStreetMapOAuth',
|
||||||
'django.contrib.auth.backends.ModelBackend',
|
'django.contrib.auth.backends.ModelBackend',
|
||||||
)
|
)
|
||||||
GITHUB_APP_ID = 'xxx'
|
SOCIAL_AUTH_GITHUB_KEY = 'xxx'
|
||||||
GITHUB_API_SECRET = 'xxx'
|
SOCIAL_AUTH_GITHUB_SECRET = 'xxx'
|
||||||
BITBUCKET_CONSUMER_KEY = 'xxx'
|
SOCIAL_AUTH_BITBUCKET_KEY = 'xxx'
|
||||||
BITBUCKET_CONSUMER_SECRET = 'xxx'
|
SOCIAL_AUTH_BITBUCKET_SECRET = 'xxx'
|
||||||
# We need email to associate with other Oauth providers
|
# We need email to associate with other Oauth providers
|
||||||
GITHUB_AUTH_EXTRA_ARGUMENTS = {"scope": "user:email"}
|
SOCIAL_AUTH_GITHUB_SCOPE = ["user:email", ]
|
||||||
TWITTER_CONSUMER_KEY = "xxx"
|
SOCIAL_AUTH_TWITTER_KEY = "xxx"
|
||||||
TWITTER_CONSUMER_SECRET = "xxx"
|
SOCIAL_AUTH_TWITTER_SECRET = "xxx"
|
||||||
OSM_CONSUMER_KEY = 'xxx'
|
SOCIAL_AUTH_OPENSTREETMAP_KEY = 'xxx'
|
||||||
OSM_CONSUMER_SECRET = 'xxx'
|
SOCIAL_AUTH_OPENSTREETMAP_SECRET = 'xxx'
|
||||||
UMAP_DEMO_PK = 34 # Pk of a Map instance
|
MIDDLEWARE_CLASSES += (
|
||||||
|
'social.apps.django_app.middleware.SocialAuthExceptionMiddleware',
|
||||||
|
)
|
||||||
|
SOCIAL_AUTH_RAISE_EXCEPTIONS = False
|
||||||
|
SOCIAL_AUTH_BACKEND_ERROR_URL = "/"
|
||||||
|
|
||||||
|
# UMAP_DEMO_PK = 204
|
||||||
|
# UMAP_SHOWCASE_PK = 1156
|
||||||
LEAFLET_STORAGE_ALLOW_ANONYMOUS = True
|
LEAFLET_STORAGE_ALLOW_ANONYMOUS = True
|
||||||
UMAP_DEMO_SITE = False
|
UMAP_DEMO_SITE = True
|
||||||
|
SITE_URL = "http://localhost:8019"
|
||||||
|
SHORT_SITE_URL = "http://s.hort"
|
||||||
SESQL_CONFIG_PATH = "umap.sesql_config"
|
SESQL_CONFIG_PATH = "umap.sesql_config"
|
||||||
|
|
||||||
|
# CACHES = {
|
||||||
|
# 'default': {
|
||||||
|
# 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
|
||||||
|
# 'LOCATION': '/var/tmp/django_cache',
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
|
||||||
|
# POSTGIS_VERSION = (2, 1, 0)
|
||||||
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<ul class="login-grid block-grid">
|
<ul class="login-grid block-grid">
|
||||||
{% for name in social_auth.backends %}
|
{% for name in backends.backends %}
|
||||||
<li>
|
<li>
|
||||||
<a rel="nofollow" href="{% url "socialauth_begin" name %}" class="storage-login-popup login-{{ name }}" title="{{ name|title }}"></a>
|
<a rel="nofollow" href="{% url "social:begin" name %}" class="storage-login-popup login-{{ name }}" title="{{ name|title }}"></a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
12
umap/urls.py
12
umap/urls.py
|
@ -12,13 +12,14 @@ from . import views
|
||||||
|
|
||||||
admin.autodiscover()
|
admin.autodiscover()
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns(
|
||||||
|
'',
|
||||||
(r'^admin/', include(admin.site.urls)),
|
(r'^admin/', include(admin.site.urls)),
|
||||||
url(r'', include('social_auth.urls')),
|
url('', include('social.apps.django_app.urls', namespace='social')),
|
||||||
# We don't want it to be localized
|
|
||||||
url(r'^m/(?P<pk>\d+)/$', MapShortUrl.as_view(), name='umap_short_url'),
|
url(r'^m/(?P<pk>\d+)/$', MapShortUrl.as_view(), name='umap_short_url'),
|
||||||
)
|
)
|
||||||
urlpatterns += i18n_patterns('',
|
urlpatterns += i18n_patterns(
|
||||||
|
'',
|
||||||
url(r'^$', views.home, name="home"),
|
url(r'^$', views.home, name="home"),
|
||||||
url(r'^showcase/$', cache_page(24 * 60 * 60)(views.showcase), name='maps_showcase'),
|
url(r'^showcase/$', cache_page(24 * 60 * 60)(views.showcase), name='maps_showcase'),
|
||||||
url(r'^search/$', views.search, name="search"),
|
url(r'^search/$', views.search, name="search"),
|
||||||
|
@ -28,6 +29,5 @@ urlpatterns += i18n_patterns('',
|
||||||
)
|
)
|
||||||
|
|
||||||
if settings.DEBUG and settings.MEDIA_ROOT:
|
if settings.DEBUG and settings.MEDIA_ROOT:
|
||||||
urlpatterns += static(settings.MEDIA_URL,
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
document_root=settings.MEDIA_ROOT)
|
|
||||||
urlpatterns += staticfiles_urlpatterns()
|
urlpatterns += staticfiles_urlpatterns()
|
||||||
|
|
Loading…
Reference in a new issue