forked from rc/aircox
merge aircox and aircox_instance
This commit is contained in:
0
instance/__init__.py
Normal file
0
instance/__init__.py
Normal file
143
instance/base_settings.py
Normal file
143
instance/base_settings.py
Normal file
@ -0,0 +1,143 @@
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(1, os.path.dirname(os.path.realpath(__file__)))
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||
PROJECT_ROOT = os.path.normpath(os.path.dirname(__file__) + "/..")
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
MEDIA_URL = '/media/'
|
||||
SITE_MEDIA_URL = '/media/'
|
||||
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
|
||||
MEDIA_ROOT = os.path.join(STATIC_ROOT, 'media')
|
||||
|
||||
# Internationalization
|
||||
USE_I18N = True
|
||||
USE_L10N = True
|
||||
USE_TZ = True
|
||||
|
||||
LANGUAGE_CODE = os.environ.get('LANG') or 'en_US'
|
||||
TIME_ZONE = os.environ.get('TZ') or 'Europe/Brussels'
|
||||
|
||||
try:
|
||||
import locale
|
||||
locale.setlocale(locale.LC_ALL, LANGUAGE_CODE)
|
||||
except:
|
||||
print(
|
||||
'Can not set locale {LC}. Is it available on you system? Hint: '
|
||||
'Check /etc/locale.gen and rerun locale-gen as sudo if needed.'
|
||||
.format(LC = LANGUAGE_CODE)
|
||||
)
|
||||
pass
|
||||
|
||||
# Application definition
|
||||
INSTALLED_APPS = (
|
||||
'wagtail.wagtailforms',
|
||||
'wagtail.wagtailredirects',
|
||||
'wagtail.wagtailembeds',
|
||||
'wagtail.wagtailsites',
|
||||
'wagtail.wagtailusers',
|
||||
'wagtail.wagtailsnippets',
|
||||
'wagtail.wagtaildocs',
|
||||
'wagtail.wagtailimages',
|
||||
'wagtail.wagtailsearch',
|
||||
'wagtail.wagtailadmin',
|
||||
'wagtail.wagtailcore',
|
||||
'wagtail.contrib.settings',
|
||||
'wagtail.contrib.modeladmin',
|
||||
|
||||
'modelcluster',
|
||||
'taggit',
|
||||
'honeypot',
|
||||
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.admin',
|
||||
|
||||
'aircox',
|
||||
'aircox_cms',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.middleware.gzip.GZipMiddleware',
|
||||
'htmlmin.middleware.HtmlMinifyMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
|
||||
'wagtail.wagtailcore.middleware.SiteMiddleware',
|
||||
'wagtail.wagtailredirects.middleware.RedirectMiddleware',
|
||||
)
|
||||
|
||||
|
||||
ROOT_URLCONF = 'instance.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': (os.path.join(PROJECT_ROOT, 'templates'),),
|
||||
# 'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': (
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.template.context_processors.debug",
|
||||
"django.template.context_processors.i18n",
|
||||
"django.template.context_processors.media",
|
||||
"django.template.context_processors.request",
|
||||
"django.template.context_processors.static",
|
||||
"django.template.context_processors.tz",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
|
||||
'wagtail.contrib.settings.context_processors.settings',
|
||||
),
|
||||
'builtins': [
|
||||
'overextends.templatetags.overextends_tags'
|
||||
],
|
||||
'loaders': (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
),
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
WSGI_APPLICATION = 'instance.wsgi.application'
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'handlers': {
|
||||
'console': {
|
||||
'class': 'logging.StreamHandler',
|
||||
},
|
||||
},
|
||||
'loggers': {
|
||||
'aircox.core': {
|
||||
'handlers': ['console'],
|
||||
'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
|
||||
},
|
||||
'aircox.test': {
|
||||
'handlers': ['console'],
|
||||
'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
|
||||
},
|
||||
'aircox.tools': {
|
||||
'handlers': ['console'],
|
||||
'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
# Wagtail
|
||||
WAGTAIL_SITE_NAME = 'Aircox'
|
||||
|
||||
|
29
instance/dev.py
Normal file
29
instance/dev.py
Normal file
@ -0,0 +1,29 @@
|
||||
import os
|
||||
|
||||
LOCALE_PATHS = ['aircox/locale', 'aircox_cms/locale']
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'handlers': {
|
||||
'console': {
|
||||
'class': 'logging.StreamHandler',
|
||||
},
|
||||
},
|
||||
'loggers': {
|
||||
'aircox.core': {
|
||||
'handlers': ['console'],
|
||||
'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG'),
|
||||
},
|
||||
'aircox.test': {
|
||||
'handlers': ['console'],
|
||||
'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG'),
|
||||
},
|
||||
'aircox.tools': {
|
||||
'handlers': ['console'],
|
||||
'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG'),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
28
instance/prod.py
Normal file
28
instance/prod.py
Normal file
@ -0,0 +1,28 @@
|
||||
import os
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'handlers': {
|
||||
'console': {
|
||||
'class': 'logging.StreamHandler',
|
||||
},
|
||||
},
|
||||
'loggers': {
|
||||
'aircox.core': {
|
||||
'handlers': ['console'],
|
||||
'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
|
||||
},
|
||||
'aircox.test': {
|
||||
'handlers': ['console'],
|
||||
'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
|
||||
},
|
||||
'aircox.tools': {
|
||||
'handlers': ['console'],
|
||||
'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
58
instance/sample_settings.py
Normal file
58
instance/sample_settings.py
Normal file
@ -0,0 +1,58 @@
|
||||
"""
|
||||
Sample file for the settings.py
|
||||
|
||||
Environment variables:
|
||||
* AIRCOX_DEBUG: enable/disable debugging
|
||||
* TZ: [in base_settings] timezone (default: 'Europe/Brussels')
|
||||
* LANG: [in base_settings] language code
|
||||
|
||||
Note that:
|
||||
- SECRET_KEY
|
||||
- ALLOWED_HOSTS
|
||||
- DATABASES
|
||||
|
||||
are not defined in base_settings and must be defined here.
|
||||
|
||||
You can also take a look at `base_settings` for more information.
|
||||
|
||||
"""
|
||||
import os
|
||||
# If Aircox is not installed as a regular python module, you can use:
|
||||
# import sys
|
||||
# sys.path.append('/path/to/aircox_parent_folder/')
|
||||
|
||||
|
||||
from .base_settings import *
|
||||
|
||||
DEBUG = False
|
||||
if 'AIRCOX_DEBUG' in os.environ:
|
||||
DEBUG = (os.environ['AIRCOX_DEBUG'].lower()) in ('true','1')
|
||||
|
||||
if DEBUG:
|
||||
from .dev import *
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
'TIMEZONE': TIME_ZONE,
|
||||
}
|
||||
}
|
||||
else:
|
||||
from .prod import *
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'NAME': 'aircox',
|
||||
'USER': 'aircox',
|
||||
'PASSWORD': '',
|
||||
'HOST': 'localhost',
|
||||
'TIMEZONE': TIME_ZONE,
|
||||
},
|
||||
}
|
||||
|
||||
ALLOWED_HOSTS = ['127.0.0.1:8042']
|
||||
SECRET_KEY = ''
|
||||
|
||||
WAGTAIL_SITE_NAME='Aircox'
|
||||
|
||||
|
47
instance/urls.py
Normal file
47
instance/urls.py
Normal file
@ -0,0 +1,47 @@
|
||||
"""aircox URL Configuration
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/1.8/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Add an import: from blog import urls as blog_urls
|
||||
2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
|
||||
"""
|
||||
from django.conf.urls import include, url
|
||||
from django.contrib import admin
|
||||
from instance import settings
|
||||
|
||||
from wagtail.wagtailadmin import urls as wagtailadmin_urls
|
||||
from wagtail.wagtaildocs import urls as wagtaildocs_urls
|
||||
from wagtail.wagtailcore import urls as wagtail_urls
|
||||
from wagtail.wagtailimages.views.serve import ServeView
|
||||
|
||||
import aircox.urls
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
url(r'^aircox/', include(aircox.urls.urls)),
|
||||
|
||||
# cms
|
||||
url(r'^cms/', include(wagtailadmin_urls)),
|
||||
url(r'^documents/', include(wagtaildocs_urls)),
|
||||
url( r'^images/([^/]*)/(\d*)/([^/]*)/[^/]*$', ServeView.as_view(),
|
||||
name='wagtailimages_serve'),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
from django.views.static import serve
|
||||
urlpatterns.append(
|
||||
url(r'^media/(?P<path>.*)$', serve,
|
||||
{'document_root': settings.MEDIA_ROOT, 'show_indexes':True}
|
||||
)
|
||||
)
|
||||
|
||||
urlpatterns.append(url(r'', include(wagtail_urls)))
|
16
instance/wsgi.py
Normal file
16
instance/wsgi.py
Normal file
@ -0,0 +1,16 @@
|
||||
"""
|
||||
WSGI config for aircox 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/1.8/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "instance.settings")
|
||||
application = get_wsgi_application()
|
||||
|
Reference in New Issue
Block a user