0.0.1 init, main page prepare
This commit is contained in:
@@ -31,22 +31,34 @@ ALLOWED_HOSTS = []
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'modeltranslation',
|
||||
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.humanize',
|
||||
|
||||
'colorfield',
|
||||
|
||||
'ckeditor',
|
||||
'ckeditor_uploader',
|
||||
|
||||
'GeneralApp',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
# 'AuthApp.middleware.ResponseInterceptionMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'pAerBim.urls'
|
||||
@@ -63,6 +75,7 @@ TEMPLATES = [
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'django.template.context_processors.media',
|
||||
],
|
||||
},
|
||||
},
|
||||
@@ -81,6 +94,17 @@ DATABASES = {
|
||||
}
|
||||
}
|
||||
|
||||
# DATABASES = {
|
||||
# 'default': {
|
||||
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
# 'NAME': 'twbDB',
|
||||
# 'USER': 'test_user',
|
||||
# 'PASSWORD': 'test_db_pass',
|
||||
# 'HOST': '127.0.0.1',
|
||||
# 'PORT': '5432',
|
||||
# }
|
||||
# }
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
|
||||
@@ -104,21 +128,135 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/4.2/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
LANGUAGE_CODE = 'ru'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
TIME_ZONE = 'Europe/Minsk'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_TZ = True
|
||||
# USE_TZ = True
|
||||
|
||||
USE_L10N = True
|
||||
|
||||
USE_TZ = False
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/4.2/howto/static-files/
|
||||
|
||||
STATIC_URL = 'static/'
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = 'media/'
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = '/'
|
||||
|
||||
STATICFILES_DIRS = [
|
||||
BASE_DIR / "static",
|
||||
]
|
||||
|
||||
|
||||
import os
|
||||
LOCALE_PATHS = (
|
||||
os.path.join(BASE_DIR,'locale'),
|
||||
)
|
||||
|
||||
|
||||
|
||||
gettext = lambda s: s
|
||||
LANGUAGES = (
|
||||
(u'ru', gettext(u'Russian')),
|
||||
(u'en', gettext(u'English')),
|
||||
)
|
||||
MODELTRANSLATION_LANGUAGES = ('ru', 'en')
|
||||
MODELTRANSLATION_ENABLE_FALLBACKS = True
|
||||
MODELTRANSLATION_FALLBACK_LANGUAGES = {
|
||||
'default': ('ru','en'),
|
||||
}
|
||||
|
||||
# Add custom languages not provided by Django
|
||||
import django.conf.locale
|
||||
LANG_INFO = dict(django.conf.locale.LANG_INFO.items()) #+ EXTRA_LANG_INFO.items())
|
||||
django.conf.locale.LANG_INFO = LANG_INFO
|
||||
|
||||
|
||||
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
|
||||
CKEDITOR_BASEPATH = "/static/ckeditor/ckeditor/"
|
||||
CKEDITOR_UPLOAD_PATH = "uploads/"
|
||||
CKEDITOR_RESTRICT_BY_DATE = False
|
||||
CKEDITOR_RESTRICT_BY_USER = True
|
||||
CKEDITOR_BROWSE_SHOW_DIRS = True
|
||||
|
||||
CKEDITOR_IMAGE_BACKEND = "pillow"
|
||||
|
||||
# CKEDITOR_BROWSE_SHOW_DIRS = True
|
||||
|
||||
CKEDITOR_JQUERY_URL = 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js'
|
||||
|
||||
CKEDITOR_CONFIGS = {
|
||||
'default': {
|
||||
'height': 291,
|
||||
'width': '70vw',
|
||||
'filebrowserWindowHeight': 600,
|
||||
'filebrowserWindowWidth': "90%",
|
||||
'toolbar': 'Custom',
|
||||
'forcePasteAsPlainText': True,
|
||||
'allowedContent': True,
|
||||
# 'disallowedContent': 'img{width,height};img[width,height]',
|
||||
# 'extraPlugins': 'image2',
|
||||
|
||||
'enterMode': 2,
|
||||
'basicEntities' : False,
|
||||
'entities_additional': '',
|
||||
'entities' : False,
|
||||
'htmlEncodeOutput' : False,
|
||||
# 'toolbar_Custom': [
|
||||
# ['Bold', 'Italic', 'Underline'],
|
||||
# ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||
# ['Link', 'Unlink'],
|
||||
# ['RemoveFormat', 'Source']
|
||||
# ],
|
||||
'toolbar_Custom': [
|
||||
{'name': 'document', 'items': ['Source', '-', 'Save', '-', 'Find', 'Replace', '-', 'SelectAll']},
|
||||
{'name': 'clipboard', 'items': ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo', '-', 'Maximize', 'ShowBlocks']},
|
||||
# {'name': 'forms',
|
||||
# 'items': ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton',
|
||||
# 'HiddenField']},
|
||||
'/',
|
||||
{'name': 'basicstyles',
|
||||
'items': ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor', '-', 'RemoveFormat', '-']},
|
||||
{'name': 'paragraph',
|
||||
'items': ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-',
|
||||
'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl'
|
||||
]},
|
||||
'/',
|
||||
{'name': 'links', 'items': ['Link', 'Unlink', 'Anchor', '-', 'Blockquote' ]},
|
||||
{'name': 'insert',
|
||||
'items': ['Image', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe']},
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try:
|
||||
import db_local_sets
|
||||
DATABASES = db_local_sets.DATABASES
|
||||
except ImportError as e:
|
||||
pass
|
||||
|
||||
# global prod_server
|
||||
try:
|
||||
import db_local_sets
|
||||
# SERVER_URL = local_sets.SERVER_URL
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
try:
|
||||
from settings_local import *
|
||||
except ImportError:
|
||||
print('settings_local fail')
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
"""
|
||||
URL configuration for pAerBim project.
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/4.2/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
from django.urls import path, include
|
||||
from django.conf.urls.static import static
|
||||
from django.conf import settings
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
# path('admin/', admin.site.urls),
|
||||
path('ckeditor/', include('ckeditor_uploader.urls')),
|
||||
path('i18n/', include('django.conf.urls.i18n')),
|
||||
|
||||
]
|
||||
|
||||
from django.conf.urls.i18n import i18n_patterns
|
||||
urlpatterns += i18n_patterns(
|
||||
path('admin/', admin.site.urls),
|
||||
|
||||
path('', include('GeneralApp.urls')),
|
||||
|
||||
|
||||
)
|
||||
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
Reference in New Issue
Block a user