Initial commit
This commit is contained in:
commit
02ad5fed3d
17 changed files with 1232 additions and 0 deletions
0
mysite/__init__.py
Normal file
0
mysite/__init__.py
Normal file
239
mysite/settings.py
Normal file
239
mysite/settings.py
Normal file
|
|
@ -0,0 +1,239 @@
|
|||
import os # isort:skip
|
||||
gettext = lambda s: s
|
||||
DATA_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||
"""
|
||||
Django settings for mysite project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 2.2.9.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/2.2/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/2.2/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = '15-d*6bl(@+jfo92@=67vi1ohx%3e&^l98*bo*v$$+ms%!l(!!'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ROOT_URLCONF = 'mysite.urls'
|
||||
|
||||
|
||||
|
||||
WSGI_APPLICATION = 'mysite.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
|
||||
|
||||
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/2.2/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'ru'
|
||||
|
||||
TIME_ZONE = 'Europe/Prague'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_L10N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/2.2/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = os.path.join(DATA_DIR, 'media')
|
||||
STATIC_ROOT = os.path.join(DATA_DIR, 'static')
|
||||
|
||||
STATICFILES_DIRS = (
|
||||
os.path.join(BASE_DIR, 'mysite', 'static'),
|
||||
)
|
||||
SITE_ID = 1
|
||||
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [os.path.join(BASE_DIR, 'mysite', 'templates'),],
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'django.template.context_processors.i18n',
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.template.context_processors.media',
|
||||
'django.template.context_processors.csrf',
|
||||
'django.template.context_processors.tz',
|
||||
'sekizai.context_processors.sekizai',
|
||||
'django.template.context_processors.static',
|
||||
'cms.context_processors.cms_settings'
|
||||
],
|
||||
'loaders': [
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader'
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
MIDDLEWARE = [
|
||||
'cms.middleware.utils.ApphookReloadMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'cms.middleware.user.CurrentUserMiddleware',
|
||||
'cms.middleware.page.CurrentPageMiddleware',
|
||||
'cms.middleware.toolbar.ToolbarMiddleware',
|
||||
'cms.middleware.language.LanguageCookieMiddleware'
|
||||
]
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'djangocms_admin_style',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.sitemaps',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.messages',
|
||||
'cms',
|
||||
'menus',
|
||||
'sekizai',
|
||||
'treebeard',
|
||||
'djangocms_text_ckeditor',
|
||||
'filer',
|
||||
'easy_thumbnails',
|
||||
# 'djangocms_bootstrap4',
|
||||
# 'djangocms_bootstrap4.contrib.bootstrap4_alerts',
|
||||
# 'djangocms_bootstrap4.contrib.bootstrap4_badge',
|
||||
# 'djangocms_bootstrap4.contrib.bootstrap4_card',
|
||||
# 'djangocms_bootstrap4.contrib.bootstrap4_carousel',
|
||||
# 'djangocms_bootstrap4.contrib.bootstrap4_collapse',
|
||||
# 'djangocms_bootstrap4.contrib.bootstrap4_content',
|
||||
# 'djangocms_bootstrap4.contrib.bootstrap4_grid',
|
||||
# 'djangocms_bootstrap4.contrib.bootstrap4_jumbotron',
|
||||
# 'djangocms_bootstrap4.contrib.bootstrap4_link',
|
||||
# 'djangocms_bootstrap4.contrib.bootstrap4_listgroup',
|
||||
# 'djangocms_bootstrap4.contrib.bootstrap4_media',
|
||||
# 'djangocms_bootstrap4.contrib.bootstrap4_picture',
|
||||
# 'djangocms_bootstrap4.contrib.bootstrap4_tabs',
|
||||
# 'djangocms_bootstrap4.contrib.bootstrap4_utilities',
|
||||
'djangocms_file',
|
||||
'djangocms_icon',
|
||||
'djangocms_link',
|
||||
'djangocms_picture',
|
||||
'djangocms_style',
|
||||
'djangocms_snippet',
|
||||
'djangocms_googlemap',
|
||||
'djangocms_video',
|
||||
'mysite'
|
||||
]
|
||||
|
||||
LANGUAGES = (
|
||||
## Customize this
|
||||
('ru', gettext('ru')),
|
||||
)
|
||||
|
||||
CMS_LANGUAGES = {
|
||||
## Customize this
|
||||
1: [
|
||||
{
|
||||
'code': 'ru',
|
||||
'name': gettext('ru'),
|
||||
'redirect_on_fallback': True,
|
||||
'public': True,
|
||||
'hide_untranslated': False,
|
||||
},
|
||||
],
|
||||
'default': {
|
||||
'redirect_on_fallback': True,
|
||||
'public': True,
|
||||
'hide_untranslated': False,
|
||||
},
|
||||
}
|
||||
|
||||
CMS_TEMPLATES = (
|
||||
## Customize this
|
||||
('fullwidth.html', 'Fullwidth'),
|
||||
('sidebar_left.html', 'Sidebar Left'),
|
||||
('sidebar_right.html', 'Sidebar Right')
|
||||
)
|
||||
|
||||
CMS_PERMISSION = True
|
||||
|
||||
CMS_PLACEHOLDER_CONF = {}
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'CONN_MAX_AGE': 0,
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'HOST': 'localhost',
|
||||
'NAME': 'project.db',
|
||||
'PASSWORD': '',
|
||||
'PORT': '',
|
||||
'USER': ''
|
||||
}
|
||||
}
|
||||
|
||||
THUMBNAIL_PROCESSORS = (
|
||||
'easy_thumbnails.processors.colorspace',
|
||||
'easy_thumbnails.processors.autocrop',
|
||||
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
|
||||
'easy_thumbnails.processors.filters'
|
||||
)
|
||||
|
||||
DJANGOCMS_PICTURE_RESPONSIVE_IMAGES = True
|
||||
DJANGOCMS_PICTURE_RESPONSIVE_IMAGES_VIEWPORT_BREAKPOINTS = [300, 400, 576, 768]
|
||||
71
mysite/static/style.css
Normal file
71
mysite/static/style.css
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/* [ON BIG SCREEN] */
|
||||
/* Wrapper */
|
||||
#page-nav {
|
||||
/* width: 100%; */
|
||||
background: #ff0;
|
||||
padding: 3px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid #ee0;
|
||||
display: block;
|
||||
/* If you want the navigation bar to stick on top
|
||||
position: sticky;
|
||||
top: 0;
|
||||
*/
|
||||
}
|
||||
|
||||
/* Hide Hamburger */
|
||||
#page-nav label, #hamburger {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Menu Items */
|
||||
#page-nav ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
#page-nav ul li {
|
||||
display: inline-block;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
#page-nav ul li a {
|
||||
/* color: #fff; */
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* [ON SMALL SCREENS] */
|
||||
@media screen and (max-width: 768px){
|
||||
/* Show Hamburger */
|
||||
#page-nav label {
|
||||
display: inline-block;
|
||||
/* color: #fff; */
|
||||
/* background: #a02620; */
|
||||
font-style: normal;
|
||||
font-size: 1.2em;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/* Break down menu items into vertical */
|
||||
#page-nav ul li {
|
||||
display: block;
|
||||
}
|
||||
#page-nav ul li {
|
||||
border-top: 1px solid #333;
|
||||
}
|
||||
|
||||
/* Toggle show/hide menu on checkbox click */
|
||||
#page-nav ul {
|
||||
display: none;
|
||||
}
|
||||
#page-nav input:checked ~ ul {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
/* [DOES NOT MATTER] */
|
||||
html, body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: arial, sans-serif;
|
||||
}
|
||||
48
mysite/templates/base.html
Normal file
48
mysite/templates/base.html
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{% load cms_tags menu_tags sekizai_tags %}
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{% block title %}This is my new project home page{% endblock title %}</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<link href="/static/style.css" rel="stylesheet">
|
||||
<style type="text/css">
|
||||
.nav {
|
||||
padding-left: 0;
|
||||
}
|
||||
.nav li {
|
||||
display: inline;
|
||||
list-style-type: none;
|
||||
padding-right: 20px;
|
||||
}
|
||||
.container {
|
||||
max-width: 940px;
|
||||
margin: 0 auto
|
||||
}
|
||||
.content {
|
||||
float: left;
|
||||
width: 80%;
|
||||
}
|
||||
.sidebar {
|
||||
float: left;
|
||||
width: 20%;
|
||||
}
|
||||
</style>
|
||||
{% render_block "css" %}
|
||||
</head>
|
||||
<body>
|
||||
{% cms_toolbar %}
|
||||
<div class="container">
|
||||
<h1>{% page_attribute "page_title" %}</h1>
|
||||
<nav id="page-nav">
|
||||
<label for="hamburger">☰</label>
|
||||
<input type="checkbox" id="hamburger"/>
|
||||
|
||||
<ul class="nav">
|
||||
{% show_menu 0 100 100 100 %}
|
||||
</ul>
|
||||
</nav>
|
||||
{% block content %}{% endblock content %}
|
||||
</div>
|
||||
{% render_block "js" %}
|
||||
</body>
|
||||
</html>
|
||||
8
mysite/templates/fullwidth.html
Normal file
8
mysite/templates/fullwidth.html
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{% extends "base.html" %}
|
||||
{% load cms_tags %}
|
||||
|
||||
{% block title %}{% page_attribute "page_title" %}{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
{% placeholder "content" %}
|
||||
{% endblock content %}
|
||||
13
mysite/templates/sidebar_left.html
Normal file
13
mysite/templates/sidebar_left.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{% extends "base.html" %}
|
||||
{% load cms_tags %}
|
||||
|
||||
{% block title %}{% page_attribute "page_title" %}{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="sidebar">
|
||||
{% placeholder "sidebar" %}
|
||||
</div>
|
||||
<div class="content">
|
||||
{% placeholder "content" %}
|
||||
</div>
|
||||
{% endblock content %}
|
||||
13
mysite/templates/sidebar_right.html
Normal file
13
mysite/templates/sidebar_right.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{% extends "base.html" %}
|
||||
{% load cms_tags %}
|
||||
|
||||
{% block title %}{% page_attribute "page_title" %}{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="content">
|
||||
{% placeholder "content" %}
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
{% placeholder "sidebar" %}
|
||||
</div>
|
||||
{% endblock content %}
|
||||
29
mysite/urls.py
Normal file
29
mysite/urls.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
from cms.sitemaps import CMSSitemap
|
||||
from django.conf import settings
|
||||
from django.conf.urls import include, url
|
||||
from django.contrib import admin
|
||||
from django.contrib.sitemaps.views import sitemap
|
||||
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
||||
from django.views.static import serve
|
||||
|
||||
admin.autodiscover()
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^sitemap\.xml$', sitemap,
|
||||
{'sitemaps': {'cmspages': CMSSitemap}}),
|
||||
]
|
||||
|
||||
urlpatterns += [
|
||||
url(r'^admin/', admin.site.urls), # NOQA
|
||||
url(r'^', include('cms.urls')),
|
||||
]
|
||||
|
||||
# This is only needed when using runserver.
|
||||
if settings.DEBUG:
|
||||
urlpatterns = [
|
||||
url(r'^media/(?P<path>.*)$', serve,
|
||||
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
|
||||
] + staticfiles_urlpatterns() + urlpatterns
|
||||
16
mysite/wsgi.py
Normal file
16
mysite/wsgi.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"""
|
||||
WSGI config for mysite project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
Loading…
Add table
Add a link
Reference in a new issue