kopia lustrzana https://github.com/rtts/django-simplecms
Sample project for testing
Since all of my django projects usually end up with a very similar structure, I thought it would be useful to include some common settings in this repository. This is useful for testig the cms app, but also as a scaffold for new projects. The syntax in settings.py is intentionally invalid, so you will have to make your desired changes before you can actually use it. My personal intended usecase: use this repository as a template for new projects, edit settings.py and add custom apps.readwriteweb
rodzic
444f4e9098
commit
d2d4915de7
|
@ -0,0 +1,103 @@
|
|||
import os, string, random
|
||||
|
||||
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
|
||||
ADMINS = [('JJ Vens', 'jj@rtts.eu')]
|
||||
ALLOWED_HOSTS = ['*']
|
||||
ROOT_URLCONF = 'project.urls'
|
||||
WSGI_APPLICATION = 'project.wsgi.application'
|
||||
LANGUAGE_CODE = 'nl'
|
||||
TIME_ZONE = 'Europe/Amsterdam'
|
||||
USE_I18N = True
|
||||
USE_L10N = True
|
||||
USE_TZ = True
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = '/srv/' + PROJECT_NAME + '/static'
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = '/srv/' + PROJECT_NAME + '/media'
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
|
||||
SECTION_TYPES = [
|
||||
('normal', 'Normaal'),
|
||||
]
|
||||
|
||||
SECTION_COLORS = [
|
||||
(1, 'Wit'),
|
||||
]
|
||||
|
||||
CKEDITOR_CONFIGS = {
|
||||
'default': {
|
||||
'removePlugins': 'elementspath',
|
||||
'extraPlugins': 'format',
|
||||
'width': '100%',
|
||||
'toolbar': 'Custom',
|
||||
# 'contentsCss': STATIC_URL + 'ckeditor.css',
|
||||
# 'allowedContent': True, # this allows iframes, embeds, scripts, etc...
|
||||
'toolbar_Custom': [
|
||||
['Format'],
|
||||
['Bold', 'Italic', 'Underline', 'TextColor'],
|
||||
['NumberedList', 'BulletedList', 'Blockquote'],
|
||||
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||
['Link', 'Unlink'],
|
||||
['RemoveFormat', 'Source'],
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'simplesass',
|
||||
PROJECT_NAME,
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'cms',
|
||||
'ckeditor',
|
||||
'embed_video',
|
||||
'easy_thumbnails',
|
||||
'django_extensions',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'simplesass.middleware.SimpleSassMiddleware',
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'USER': PROJECT_NAME,
|
||||
'NAME': PROJECT_NAME,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
from django.conf import settings
|
||||
from django.urls import path, include
|
||||
from django.contrib import admin
|
||||
from django.conf.urls.static import static
|
||||
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
||||
from django.contrib import admin
|
||||
from django.views.generic import RedirectView
|
||||
|
||||
admin.site.site_header = settings.PROJECT_NAME.capitalize()
|
||||
admin.site.site_title = settings.PROJECT_NAME.capitalize()
|
||||
|
||||
urlpatterns = []
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += staticfiles_urlpatterns()
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
urlpatterns += [
|
||||
path('admin/', admin.site.urls),
|
||||
path('accounts/', include('django.contrib.auth.urls')),
|
||||
path('login/', RedirectView.as_view(url='/accounts/login/')),
|
||||
path('', include('cms.urls', namespace='cms')),
|
||||
]
|
|
@ -0,0 +1,16 @@
|
|||
"""
|
||||
WSGI config for project 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', 'project.settings')
|
||||
|
||||
application = get_wsgi_application()
|
Ładowanie…
Reference in New Issue