kopia lustrzana https://github.com/rtts/django-simplecms
Move `project` module to examples subdirectory, since it is not
a functioning Python module without editing settings.py and customizing the PROJECT_NAME variable. Also, some small CSS tweaks and a rewrite of README.mdreadwriteweb
rodzic
dd9bc98b7d
commit
c9a4d4e0fd
|
@ -1,3 +1 @@
|
||||||
recursive-include cms/static *
|
recursive-include ** *
|
||||||
recursive-include cms/templates *
|
|
||||||
recursive-include cms/locale *
|
|
||||||
|
|
46
README.md
46
README.md
|
@ -1,37 +1,23 @@
|
||||||
Django Simple CMS
|
Django Simple CMS
|
||||||
=================
|
=================
|
||||||
|
|
||||||
Simple CMS app with models that should suit everyone's small website needs.
|
Hello stranger! You have stumbled on my personal Django boilerplate
|
||||||
|
repository. It contains all those code fragments that I find myself
|
||||||
|
writing over and over again when I create websites for clients.
|
||||||
|
There's models for Pages and Sections in the `cms` app, as well as
|
||||||
|
some basic HTML and CSS designs. There's a NumberedModel in the
|
||||||
|
`numberedmodel` app. There's simple SASS compiler in `simplesass`.
|
||||||
|
|
||||||
Installation
|
With these apps it's very simple to setup a basic website. Simply use
|
||||||
------------
|
the project template from the `examples` directory as a starting
|
||||||
|
point. Then run the following Django commands:
|
||||||
|
|
||||||
pip install git+https://github.com/rtts/django-simplecms.git
|
$ ./manage.py migrate
|
||||||
|
$ ./manage.py createsuperuser
|
||||||
|
$ ./manage.py runserver --nostatic
|
||||||
|
|
||||||
Configuration
|
(The `--nostatic` argument is needed to make `simplesass` work.)
|
||||||
-------------
|
|
||||||
|
|
||||||
Add the following to your Django settings:
|
Now point your browser to http://localhost:8000/ and there will be a
|
||||||
|
website ready to be edited using the CMS views! All you need to do
|
||||||
INSTALLED_APPS += [
|
next is to hire a graphic designer ;-)
|
||||||
'cms',
|
|
||||||
'ckeditor',
|
|
||||||
'embed_video',
|
|
||||||
'easy_thumbnails',
|
|
||||||
]
|
|
||||||
|
|
||||||
SECTION_TYPES = [
|
|
||||||
('normal', 'Normaal'),
|
|
||||||
]
|
|
||||||
|
|
||||||
SECTION_COLORS = [
|
|
||||||
(1, 'Licht'),
|
|
||||||
(2, 'Donker'),
|
|
||||||
]
|
|
||||||
|
|
||||||
And add the following to your URL patterns:
|
|
||||||
|
|
||||||
urlpatterns += [
|
|
||||||
path('accounts/', include('django.contrib.auth.urls')),
|
|
||||||
path('', include('cms.urls', namespace='cms')),
|
|
||||||
]
|
|
||||||
|
|
|
@ -25,10 +25,26 @@ header, nav, section, footer {
|
||||||
}
|
}
|
||||||
|
|
||||||
nav {
|
nav {
|
||||||
@media(min-width: $small) {
|
|
||||||
button#hamburger {
|
button#hamburger {
|
||||||
display: none;
|
position: absolute;
|
||||||
|
z-index: 1;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
|
||||||
|
.hamburger-inner, .hamburger-inner:before, .hamburger-inner:after {
|
||||||
|
background: black;
|
||||||
}
|
}
|
||||||
|
&.is-active {
|
||||||
|
position: fixed;
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
opacity: 1 !important;
|
||||||
|
}
|
||||||
|
&:focus {
|
||||||
|
outline: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ul#menu {
|
ul#menu {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -36,7 +52,7 @@ nav {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
li {
|
li {
|
||||||
margin: 1em;
|
margin: .5em;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
||||||
|
@ -55,29 +71,19 @@ nav {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media(min-width: $small) {
|
||||||
|
button#hamburger {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media(max-width: $small) {
|
@media(max-width: $small) {
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
button#hamburger {
|
button#hamburger {
|
||||||
position: absolute;
|
display: block;
|
||||||
z-index: 1;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
|
|
||||||
.hamburger-inner, .hamburger-inner:before, .hamburger-inner:after {
|
|
||||||
background: black !important;
|
|
||||||
}
|
}
|
||||||
&.is-active {
|
|
||||||
position: fixed;
|
|
||||||
}
|
|
||||||
&:hover {
|
|
||||||
opacity: 1 !important;
|
|
||||||
}
|
|
||||||
&:focus {
|
|
||||||
outline: none !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ul#menu {
|
ul#menu {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
@ -93,6 +99,7 @@ nav {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
|
||||||
li {
|
li {
|
||||||
|
display: block;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
margin: 0 1em;
|
margin: 0 1em;
|
||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
|
@ -100,7 +107,6 @@ nav {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: black;
|
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,7 +207,7 @@ article {
|
||||||
}
|
}
|
||||||
|
|
||||||
div.title {
|
div.title {
|
||||||
font-size: 2em;
|
//font-size: 2em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,16 +16,27 @@ div.spacer {
|
||||||
header, nav, section, footer {
|
header, nav, section, footer {
|
||||||
padding: 1rem; }
|
padding: 1rem; }
|
||||||
|
|
||||||
@media (min-width: 500px) {
|
nav button#hamburger {
|
||||||
nav button#hamburger {
|
position: absolute;
|
||||||
display: none; }
|
z-index: 1;
|
||||||
nav ul#menu {
|
top: 0;
|
||||||
|
right: 0; }
|
||||||
|
nav button#hamburger .hamburger-inner, nav button#hamburger .hamburger-inner:before, nav button#hamburger .hamburger-inner:after {
|
||||||
|
background: black; }
|
||||||
|
nav button#hamburger.is-active {
|
||||||
|
position: fixed; }
|
||||||
|
nav button#hamburger:hover {
|
||||||
|
opacity: 1 !important; }
|
||||||
|
nav button#hamburger:focus {
|
||||||
|
outline: none !important; }
|
||||||
|
|
||||||
|
nav ul#menu {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
text-align: center; }
|
text-align: center; }
|
||||||
nav ul#menu li {
|
nav ul#menu li {
|
||||||
margin: 1em;
|
margin: .5em;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
display: inline-block; }
|
display: inline-block; }
|
||||||
nav ul#menu li a {
|
nav ul#menu li a {
|
||||||
|
@ -37,22 +48,17 @@ header, nav, section, footer {
|
||||||
font-size: 1.25em; }
|
font-size: 1.25em; }
|
||||||
nav ul#menu li a:hover, nav ul#menu li a.current {
|
nav ul#menu li a:hover, nav ul#menu li a.current {
|
||||||
transform: scale(1.2);
|
transform: scale(1.2);
|
||||||
transform-origin: bottom; } }
|
transform-origin: bottom; }
|
||||||
|
|
||||||
|
@media (min-width: 500px) {
|
||||||
|
nav button#hamburger {
|
||||||
|
display: none; } }
|
||||||
|
|
||||||
@media (max-width: 500px) {
|
@media (max-width: 500px) {
|
||||||
|
nav {
|
||||||
|
padding: 0; }
|
||||||
nav button#hamburger {
|
nav button#hamburger {
|
||||||
position: absolute;
|
display: block; }
|
||||||
z-index: 1;
|
|
||||||
top: 0;
|
|
||||||
right: 0; }
|
|
||||||
nav button#hamburger .hamburger-inner, nav button#hamburger .hamburger-inner:before, nav button#hamburger .hamburger-inner:after {
|
|
||||||
background: black !important; }
|
|
||||||
nav button#hamburger.is-active {
|
|
||||||
position: fixed; }
|
|
||||||
nav button#hamburger:hover {
|
|
||||||
opacity: 1 !important; }
|
|
||||||
nav button#hamburger:focus {
|
|
||||||
outline: none !important; }
|
|
||||||
nav ul#menu {
|
nav ul#menu {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
@ -69,13 +75,13 @@ header, nav, section, footer {
|
||||||
transition: .5s ease;
|
transition: .5s ease;
|
||||||
transform: translatex(100%); }
|
transform: translatex(100%); }
|
||||||
nav ul#menu li {
|
nav ul#menu li {
|
||||||
|
display: block;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
margin: 0 1em;
|
margin: 0 1em;
|
||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
text-align: center; }
|
text-align: center; }
|
||||||
nav ul#menu li a {
|
nav ul#menu li a {
|
||||||
color: black;
|
|
||||||
text-decoration: none; }
|
text-decoration: none; }
|
||||||
nav ul#menu.visible {
|
nav ul#menu.visible {
|
||||||
transform: translatex(0); } }
|
transform: translatex(0); } }
|
||||||
|
@ -143,7 +149,6 @@ article section {
|
||||||
article section div.image img {
|
article section div.image img {
|
||||||
width: 100%; }
|
width: 100%; }
|
||||||
article section div.title {
|
article section div.title {
|
||||||
font-size: 2em;
|
|
||||||
text-align: center; }
|
text-align: center; }
|
||||||
article section div.video div.iframe {
|
article section div.video div.iframe {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,14 +1,12 @@
|
||||||
import os, string, random
|
import os, random, string
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import uwsgi
|
import uwsgi
|
||||||
SECRET_KEY = ''.join(random.choice(string.printable) for x in range(50))
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
except ImportError:
|
except ImportError:
|
||||||
SECRET_KEY = 'abc'
|
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
|
|
||||||
PROJECT_NAME = INSERT_PROJECT_NAME_HERE
|
PROJECT_NAME = INSERT_PROJECT_NAME_HERE
|
||||||
|
KEYFILE = f'/tmp/{PROJECT_NAME}.secret'
|
||||||
ADMINS = [('JJ Vens', 'jj@rtts.eu')]
|
ADMINS = [('JJ Vens', 'jj@rtts.eu')]
|
||||||
ALLOWED_HOSTS = ['*']
|
ALLOWED_HOSTS = ['*']
|
||||||
ROOT_URLCONF = 'project.urls'
|
ROOT_URLCONF = 'project.urls'
|
||||||
|
@ -24,6 +22,18 @@ MEDIA_URL = '/media/'
|
||||||
MEDIA_ROOT = '/srv/' + PROJECT_NAME + '/media'
|
MEDIA_ROOT = '/srv/' + PROJECT_NAME + '/media'
|
||||||
LOGIN_REDIRECT_URL = '/'
|
LOGIN_REDIRECT_URL = '/'
|
||||||
|
|
||||||
|
def read(file):
|
||||||
|
with open(file) as f:
|
||||||
|
return f.read()
|
||||||
|
def write(file, content):
|
||||||
|
with open(file, 'w') as f:
|
||||||
|
f.write(content)
|
||||||
|
try:
|
||||||
|
SECRET_KEY = read(KEYFILE)
|
||||||
|
except IOError:
|
||||||
|
SECRET_KEY = ''.join(random.choice(string.printable) for x in range(50))
|
||||||
|
write(KEYFILE, SECRET_KEY)
|
||||||
|
|
||||||
SECTION_TYPES = [
|
SECTION_TYPES = [
|
||||||
('normal', 'Normaal'),
|
('normal', 'Normaal'),
|
||||||
]
|
]
|
|
@ -5,3 +5,4 @@ django-extensions
|
||||||
django-embed-video
|
django-embed-video
|
||||||
easy-thumbnails
|
easy-thumbnails
|
||||||
psycopg2
|
psycopg2
|
||||||
|
libsass
|
||||||
|
|
Ładowanie…
Reference in New Issue