2026-02-24 13:24:56 +00:00

108 lines
3.2 KiB
Python

# -*- coding: utf-8 -*-
import os.path
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
PROJECT_PATH = os.path.abspath(os.path.dirname(__name__))
ALLOWED_HOSTS = []
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.humanize',
'django.contrib.staticfiles',
'social.apps.django_app.default',
'imagekit',
'braces',
'bootstrapform',
'app'
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware'
)
AUTH_USER_MODEL = 'app.User'
ROOT_URLCONF = 'app.urls'
WSGI_APPLICATION = 'app.wsgi.application'
LOGIN_REDIRECT_URL = 'my-profile'
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(PROJECT_PATH, 'static')
# User uploaded files
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# STATICFILES_DIRS = (
# # Put strings here, like "/home/html/static" or "C:/www/django/static".
# # Always use forward slashes, even on Windows.
# # Don't forget to use absolute paths, not relative paths.
# os.path.join(
# os.path.dirname(__file__),
# 'static',
# ),
# )
TEMPLATE_DIRS = (
os.path.join(BASE_DIR, 'templates'),
)
SOCIAL_AUTH_USER_MODEL = 'app.User'
SOCIAL_AUTH_LOGIN_URL = 'django.contrib.auth.views.login'
SOCIAL_AUTH_LOGIN_REDIRECT_URL = 'my-profile'
SOCIAL_AUTH_NEW_USER_REDIRECT_URL = 'my-profile'
#SOCIAL_AUTH_LOGIN_ERROR_URL = ''
#SOCIAL_AUTH_DISCONNECT_REDIRECT_URL = ''
SOCIAL_AUTH_PIPELINE = (
'social.pipeline.social_auth.social_details',
'social.pipeline.social_auth.social_uid',
'social.pipeline.social_auth.auth_allowed',
'social.pipeline.social_auth.social_user',
'social.pipeline.user.get_username',
'app.pipeline.create_user',
'social.pipeline.social_auth.associate_user',
'social.pipeline.social_auth.load_extra_data',
'social.pipeline.user.user_details',
)
AUTHENTICATION_BACKENDS = (
'social.backends.facebook.FacebookOAuth2',
'django.contrib.auth.backends.ModelBackend',
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
'social.apps.django_app.context_processors.backends',
'social.apps.django_app.context_processors.login_redirect',
)
#EXTRA DATA from facebook, full list available here => https://developers.facebook.com/tools/explorer/?method=GET&path=me
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email', 'user_about_me', 'user_birthday', 'user_photos']
SOCIAL_AUTH_FACEBOOK_KEY = ''
SOCIAL_AUTH_FACEBOOK_SECRET = ''