version 0.0.2: updated requirements list, updated settings, expanded the list of supported languages
This commit is contained in:
parent
fc2a689b6d
commit
76c6aef09c
7
apps/account/translation.py
Normal file
7
apps/account/translation.py
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
from modeltranslation.translator import TranslationOptions, register
|
||||||
|
from .models import User
|
||||||
|
|
||||||
|
|
||||||
|
@register(User)
|
||||||
|
class UserModelTranslation(TranslationOptions):
|
||||||
|
"""Translation for mode User"""
|
||||||
|
|
@ -19,7 +19,7 @@ PROJECT_ROOT = os.path.abspath(os.path.join(BASE_DIR, '..'))
|
||||||
PUBLIC_ROOT = os.path.abspath(os.path.join(BASE_DIR, '..', 'media'))
|
PUBLIC_ROOT = os.path.abspath(os.path.join(BASE_DIR, '..', 'media'))
|
||||||
|
|
||||||
# # insert apps and libs dirs to sys.path
|
# # insert apps and libs dirs to sys.path
|
||||||
for path in ('apps', 'services',):
|
for path in ('apps', ):
|
||||||
path = os.path.abspath(os.path.join(PROJECT_ROOT, '%s' % path))
|
path = os.path.abspath(os.path.join(PROJECT_ROOT, '%s' % path))
|
||||||
path in sys.path or sys.path.insert(0, path)
|
path in sys.path or sys.path.insert(0, path)
|
||||||
|
|
||||||
|
|
@ -63,6 +63,9 @@ EXTERNAL_APPS = [
|
||||||
'rest_framework',
|
'rest_framework',
|
||||||
'rest_framework.authtoken',
|
'rest_framework.authtoken',
|
||||||
'easy_select2',
|
'easy_select2',
|
||||||
|
'oauth2_provider',
|
||||||
|
'social_django',
|
||||||
|
'rest_framework_social_oauth2',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -92,6 +95,9 @@ TEMPLATES = [
|
||||||
'django.template.context_processors.request',
|
'django.template.context_processors.request',
|
||||||
'django.contrib.auth.context_processors.auth',
|
'django.contrib.auth.context_processors.auth',
|
||||||
'django.contrib.messages.context_processors.messages',
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
# OAuth
|
||||||
|
'social_django.context_processors.backends',
|
||||||
|
'social_django.context_processors.login_redirect',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -141,7 +147,47 @@ LOGOUT_URL = 'admin:logout'
|
||||||
# Internationalization
|
# Internationalization
|
||||||
# https://docs.djangoproject.com/en/2.2/topics/i18n/
|
# https://docs.djangoproject.com/en/2.2/topics/i18n/
|
||||||
|
|
||||||
LANGUAGE_CODE = 'ru'
|
LANGUAGE_CODE = 'ru-RU'
|
||||||
|
|
||||||
|
gettext = lambda s: s
|
||||||
|
LANGUAGES = (
|
||||||
|
('ru-RU', gettext('Russian')),
|
||||||
|
('en-GB', gettext('English')),
|
||||||
|
('fr-FR', gettext('French')),
|
||||||
|
('hr-HR', gettext('Croatian')),
|
||||||
|
('ro-RO', gettext('Romanian')),
|
||||||
|
('de-DE', gettext('Deutsch')),
|
||||||
|
('nl-BE', gettext('Nederlands')),
|
||||||
|
('ja-JP', gettext('Japanese')),
|
||||||
|
('ka-GE', gettext('Georgian')),
|
||||||
|
('fr-CA', gettext('French')),
|
||||||
|
('fr-BE', gettext('French')),
|
||||||
|
('fr-MA', gettext('French')),
|
||||||
|
('de-AT', gettext('Deutsch')),
|
||||||
|
('en-US', gettext('English')),
|
||||||
|
('en-AU', gettext('English')),
|
||||||
|
('en-CA', gettext('English')),
|
||||||
|
('hu-HU', gettext('Hungarian')),
|
||||||
|
('he-IL', gettext('Hebrew')),
|
||||||
|
('it-IT', gettext('Italian')),
|
||||||
|
('sl-SI', gettext('Slovenian')),
|
||||||
|
('el-GR', gettext('Greek')),
|
||||||
|
('pl-PL', gettext('Polish')),
|
||||||
|
('pt-BR', gettext('Brasilian')),
|
||||||
|
)
|
||||||
|
MODELTRANSLATION_LANGUAGES = (
|
||||||
|
'ru-RU', 'en-GB', 'fr-FR', 'hr-HR',
|
||||||
|
'ro-RO', 'de-DE', 'nl-BE', 'ja-JP',
|
||||||
|
'ka-GE', 'fr-CA', 'fr-BE', 'fr-MA',
|
||||||
|
'de-AT', 'en-US', 'en-AU', 'en-CA',
|
||||||
|
'hu-HU', 'he-IL', 'it-IT', 'sl-SI',
|
||||||
|
'el-GR', 'pl-PL', 'pt-BR',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Facebook configuration
|
||||||
|
SOCIAL_AUTH_FACEBOOK_KEY = '386843648701452'
|
||||||
|
SOCIAL_AUTH_FACEBOOK_SECRET = 'a71cf0bf3980843a8f1ea74c6d805fd7'
|
||||||
|
|
||||||
|
|
||||||
TIME_ZONE = 'UTC'
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
|
@ -187,6 +233,10 @@ REST_FRAMEWORK = {
|
||||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
'rest_framework.authentication.TokenAuthentication',
|
'rest_framework.authentication.TokenAuthentication',
|
||||||
'rest_framework.authentication.SessionAuthentication',
|
'rest_framework.authentication.SessionAuthentication',
|
||||||
|
# OAuth
|
||||||
|
'oauth2_provider.contrib.rest_framework.OAuth2Authentication',
|
||||||
|
'rest_framework_social_oauth2.authentication.SocialAuthentication',
|
||||||
|
|
||||||
),
|
),
|
||||||
'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.AcceptHeaderVersioning',
|
'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.AcceptHeaderVersioning',
|
||||||
'DEFAULT_VERSION': (AVAILABLE_VERSIONS['current'],),
|
'DEFAULT_VERSION': (AVAILABLE_VERSIONS['current'],),
|
||||||
|
|
@ -201,6 +251,18 @@ REST_FRAMEWORK = {
|
||||||
REST_DATE_FORMAT = '%m-%d-%Y'
|
REST_DATE_FORMAT = '%m-%d-%Y'
|
||||||
REST_DATETIME_FORMAT = '%m-%d-%Y %H:%M:%S'
|
REST_DATETIME_FORMAT = '%m-%d-%Y %H:%M:%S'
|
||||||
|
|
||||||
|
AUTHENTICATION_BACKENDS = (
|
||||||
|
# Facebook OAuth2
|
||||||
|
'social_core.backends.facebook.FacebookAppOAuth2',
|
||||||
|
'social_core.backends.facebook.FacebookOAuth2',
|
||||||
|
|
||||||
|
# django-rest-framework-social-oauth2
|
||||||
|
'rest_framework_social_oauth2.backends.DjangoOAuth2',
|
||||||
|
|
||||||
|
# Django
|
||||||
|
'django.contrib.auth.backends.ModelBackend',
|
||||||
|
)
|
||||||
|
|
||||||
# SMS Settings
|
# SMS Settings
|
||||||
SMS_EXPIRATION = 5
|
SMS_EXPIRATION = 5
|
||||||
SMS_SEND_DELAY = 30
|
SMS_SEND_DELAY = 30
|
||||||
|
|
@ -239,7 +301,6 @@ REDOC_SETTINGS = {
|
||||||
'LAZY_RENDERING': False,
|
'LAZY_RENDERING': False,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# CELERY
|
# CELERY
|
||||||
BROKER_URL = 'amqp://rabbitmq:5672'
|
BROKER_URL = 'amqp://rabbitmq:5672'
|
||||||
CELERY_RESULT_BACKEND = BROKER_URL
|
CELERY_RESULT_BACKEND = BROKER_URL
|
||||||
|
|
@ -250,7 +311,6 @@ CELERY_RESULT_SERIALIZER = 'json'
|
||||||
CELERY_TIMEZONE = TIME_ZONE
|
CELERY_TIMEZONE = TIME_ZONE
|
||||||
USE_CELERY = False
|
USE_CELERY = False
|
||||||
|
|
||||||
|
|
||||||
# Django FCM (Firebase push notificatoins)
|
# Django FCM (Firebase push notificatoins)
|
||||||
FCM_DJANGO_SETTINGS = {
|
FCM_DJANGO_SETTINGS = {
|
||||||
'FCM_SERVER_KEY': (
|
'FCM_SERVER_KEY': (
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ from django.conf.urls.static import static
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path, include, re_path
|
from django.urls import path, include, re_path
|
||||||
from drf_yasg import openapi
|
from drf_yasg import openapi
|
||||||
|
from django.conf.urls import url
|
||||||
from drf_yasg.views import get_schema_view
|
from drf_yasg.views import get_schema_view
|
||||||
from rest_framework import permissions
|
from rest_framework import permissions
|
||||||
|
|
||||||
|
|
@ -47,6 +48,11 @@ urlpatterns_doc = [
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
urlpatterns_oauth2 = [
|
||||||
|
url(r'^auth/', include('rest_framework_social_oauth2.urls')),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
urlpatterns_api = [
|
urlpatterns_api = [
|
||||||
path('account/', include('account.urls'), name='account'),
|
path('account/', include('account.urls'), name='account'),
|
||||||
|
|
||||||
|
|
@ -57,7 +63,12 @@ urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
|
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
|
||||||
path('api/', include(urlpatterns_api)),
|
path('api/', include(urlpatterns_api)),
|
||||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
]
|
||||||
|
|
||||||
|
urlpatterns = urlpatterns + \
|
||||||
|
static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + \
|
||||||
|
urlpatterns_oauth2
|
||||||
|
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
urlpatterns.extend(urlpatterns_doc)
|
urlpatterns.extend(urlpatterns_doc)
|
||||||
|
|
|
||||||
|
|
@ -18,3 +18,7 @@ celery
|
||||||
amqp>=2.4.0
|
amqp>=2.4.0
|
||||||
|
|
||||||
cloudpayments
|
cloudpayments
|
||||||
|
|
||||||
|
# auth socials
|
||||||
|
django-rest-framework-social-oauth2==1.1.0
|
||||||
|
django-modeltranslation==0.13.3
|
||||||
Loading…
Reference in New Issue
Block a user