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 cms/templates *
|
||||
recursive-include cms/locale *
|
||||
recursive-include ** *
|
||||
|
|
46
README.md
46
README.md
|
@ -1,37 +1,23 @@
|
|||
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:
|
||||
|
||||
INSTALLED_APPS += [
|
||||
'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')),
|
||||
]
|
||||
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
|
||||
next is to hire a graphic designer ;-)
|
||||
|
|
|
@ -25,59 +25,65 @@ header, nav, section, footer {
|
|||
}
|
||||
|
||||
nav {
|
||||
@media(min-width: $small) {
|
||||
button#hamburger {
|
||||
display: none;
|
||||
button#hamburger {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
right: 0;
|
||||
|
||||
.hamburger-inner, .hamburger-inner:before, .hamburger-inner:after {
|
||||
background: black;
|
||||
}
|
||||
ul#menu {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
&.is-active {
|
||||
position: fixed;
|
||||
}
|
||||
&:hover {
|
||||
opacity: 1 !important;
|
||||
}
|
||||
&:focus {
|
||||
outline: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
ul#menu {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
|
||||
li {
|
||||
margin: .5em;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
|
||||
li {
|
||||
margin: 1em;
|
||||
padding: 0;
|
||||
a {
|
||||
transition: .1s ease;
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
font-weight: bold;
|
||||
font-size: 1.25em;
|
||||
|
||||
a {
|
||||
transition: .1s ease;
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
font-weight: bold;
|
||||
font-size: 1.25em;
|
||||
|
||||
&:hover, &.current {
|
||||
transform: scale(1.2);
|
||||
transform-origin: bottom;
|
||||
}
|
||||
&:hover, &.current {
|
||||
transform: scale(1.2);
|
||||
transform-origin: bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media(max-width: $small) {
|
||||
@media(min-width: $small) {
|
||||
button#hamburger {
|
||||
position: absolute;
|
||||
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;
|
||||
}
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media(max-width: $small) {
|
||||
padding: 0;
|
||||
|
||||
button#hamburger {
|
||||
display: block;
|
||||
}
|
||||
ul#menu {
|
||||
position: fixed;
|
||||
overflow-y: auto;
|
||||
|
@ -93,6 +99,7 @@ nav {
|
|||
list-style: none;
|
||||
|
||||
li {
|
||||
display: block;
|
||||
padding: 1em;
|
||||
margin: 0 1em;
|
||||
border-bottom: 1px solid #ddd;
|
||||
|
@ -100,7 +107,6 @@ nav {
|
|||
text-align: center;
|
||||
|
||||
a {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
@ -201,7 +207,7 @@ article {
|
|||
}
|
||||
|
||||
div.title {
|
||||
font-size: 2em;
|
||||
//font-size: 2em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,69 +16,75 @@ div.spacer {
|
|||
header, nav, section, footer {
|
||||
padding: 1rem; }
|
||||
|
||||
nav button#hamburger {
|
||||
position: absolute;
|
||||
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; }
|
||||
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;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
text-align: center; }
|
||||
nav ul#menu li {
|
||||
margin: .5em;
|
||||
padding: 0;
|
||||
display: inline-block; }
|
||||
nav ul#menu li a {
|
||||
transition: .1s ease;
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
font-weight: bold;
|
||||
font-size: 1.25em; }
|
||||
nav ul#menu li a:hover, nav ul#menu li a.current {
|
||||
transform: scale(1.2);
|
||||
transform-origin: bottom; }
|
||||
|
||||
@media (min-width: 500px) {
|
||||
nav button#hamburger {
|
||||
display: none; }
|
||||
nav ul#menu {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
text-align: center; }
|
||||
nav ul#menu li {
|
||||
margin: 1em;
|
||||
padding: 0;
|
||||
display: inline-block; }
|
||||
nav ul#menu li a {
|
||||
transition: .1s ease;
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
font-weight: bold;
|
||||
font-size: 1.25em; }
|
||||
nav ul#menu li a:hover, nav ul#menu li a.current {
|
||||
transform: scale(1.2);
|
||||
transform-origin: bottom; } }
|
||||
display: none; } }
|
||||
|
||||
@media (max-width: 500px) {
|
||||
nav button#hamburger {
|
||||
position: absolute;
|
||||
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 {
|
||||
position: fixed;
|
||||
overflow-y: auto;
|
||||
z-index: 1;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
padding-top: 2em;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: white;
|
||||
list-style: none;
|
||||
transition: .5s ease;
|
||||
transform: translatex(100%); }
|
||||
nav ul#menu li {
|
||||
padding: 1em;
|
||||
margin: 0 1em;
|
||||
border-bottom: 1px solid #ddd;
|
||||
line-height: 1.5;
|
||||
text-align: center; }
|
||||
nav ul#menu li a {
|
||||
color: black;
|
||||
text-decoration: none; }
|
||||
nav ul#menu.visible {
|
||||
transform: translatex(0); } }
|
||||
nav {
|
||||
padding: 0; }
|
||||
nav button#hamburger {
|
||||
display: block; }
|
||||
nav ul#menu {
|
||||
position: fixed;
|
||||
overflow-y: auto;
|
||||
z-index: 1;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
padding-top: 2em;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: white;
|
||||
list-style: none;
|
||||
transition: .5s ease;
|
||||
transform: translatex(100%); }
|
||||
nav ul#menu li {
|
||||
display: block;
|
||||
padding: 1em;
|
||||
margin: 0 1em;
|
||||
border-bottom: 1px solid #ddd;
|
||||
line-height: 1.5;
|
||||
text-align: center; }
|
||||
nav ul#menu li a {
|
||||
text-decoration: none; }
|
||||
nav ul#menu.visible {
|
||||
transform: translatex(0); } }
|
||||
|
||||
div.edit {
|
||||
text-align: center; }
|
||||
|
@ -143,7 +149,6 @@ article section {
|
|||
article section div.image img {
|
||||
width: 100%; }
|
||||
article section div.title {
|
||||
font-size: 2em;
|
||||
text-align: center; }
|
||||
article section div.video div.iframe {
|
||||
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:
|
||||
import uwsgi
|
||||
SECRET_KEY = ''.join(random.choice(string.printable) for x in range(50))
|
||||
DEBUG = False
|
||||
except ImportError:
|
||||
SECRET_KEY = 'abc'
|
||||
DEBUG = True
|
||||
|
||||
PROJECT_NAME = INSERT_PROJECT_NAME_HERE
|
||||
KEYFILE = f'/tmp/{PROJECT_NAME}.secret'
|
||||
ADMINS = [('JJ Vens', 'jj@rtts.eu')]
|
||||
ALLOWED_HOSTS = ['*']
|
||||
ROOT_URLCONF = 'project.urls'
|
||||
|
@ -24,6 +22,18 @@ MEDIA_URL = '/media/'
|
|||
MEDIA_ROOT = '/srv/' + PROJECT_NAME + '/media'
|
||||
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 = [
|
||||
('normal', 'Normaal'),
|
||||
]
|
|
@ -5,3 +5,4 @@ django-extensions
|
|||
django-embed-video
|
||||
easy-thumbnails
|
||||
psycopg2
|
||||
libsass
|
||||
|
|
Ładowanie…
Reference in New Issue