cleanup settings.py/local_settings.py/config.json
This commit is contained in:
parent
dffa404e98
commit
2748ab6978
6 changed files with 68 additions and 61 deletions
|
@ -556,10 +556,9 @@
|
||||||
// E-mail address uses by the system (from)
|
// E-mail address uses by the system (from)
|
||||||
"system": "0xdb@0xdb.org"
|
"system": "0xdb@0xdb.org"
|
||||||
},
|
},
|
||||||
// fixme: there should be no magic applied to this file
|
"id": "oxdb",
|
||||||
"id": "{{settings.SITEID}}",
|
"name": "0xDb",
|
||||||
"name": "{{settings.SITENAME}}",
|
"url": "0xdb.org",
|
||||||
"url": "{{settings.URL}}",
|
|
||||||
"videoprefix": ""
|
"videoprefix": ""
|
||||||
},
|
},
|
||||||
"sitePages": [
|
"sitePages": [
|
||||||
|
|
|
@ -9,6 +9,8 @@ import time
|
||||||
import thread
|
import thread
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
import ox.jsonc
|
import ox.jsonc
|
||||||
from ox.utils import json
|
from ox.utils import json
|
||||||
|
|
||||||
|
@ -24,10 +26,11 @@ def load_config():
|
||||||
config = None
|
config = None
|
||||||
|
|
||||||
if config:
|
if config:
|
||||||
config['site']['id'] = settings.SITEID
|
settings.SITENAME = config['site']['name']
|
||||||
config['site']['name'] = settings.SITENAME
|
settings.URL = config['site']['url']
|
||||||
config['site']['sectionName'] = settings.SITENAME
|
settings.EMAIL_SUBJECT_PREFIX = '[%s]'%settings.SITENAME
|
||||||
config['site']['url'] = settings.URL
|
settings.DEFAULT_FROM_EMAIL = config['site']['email']['system']
|
||||||
|
settings.SERVER_EMAIL = config['site']['email']['system']
|
||||||
config['site']['videoprefix'] = settings.VIDEO_PREFIX
|
config['site']['videoprefix'] = settings.VIDEO_PREFIX
|
||||||
|
|
||||||
config['keys'] = {}
|
config['keys'] = {}
|
||||||
|
@ -36,6 +39,11 @@ def load_config():
|
||||||
|
|
||||||
settings.CONFIG = config
|
settings.CONFIG = config
|
||||||
|
|
||||||
|
admin = len(settings.CONFIG['userLevels']) - 1
|
||||||
|
settings.ADMIN = tuple([(u.username, u.email)
|
||||||
|
for u in User.objects.filter(profile__level=admin)])
|
||||||
|
settings.MANAGERS = settings.ADMINS
|
||||||
|
|
||||||
def reloader_thread():
|
def reloader_thread():
|
||||||
_config_mtime = 0
|
_config_mtime = 0
|
||||||
while RUN_RELOADER:
|
while RUN_RELOADER:
|
||||||
|
|
|
@ -21,7 +21,10 @@ def intro(request):
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
context = RequestContext(request, {'settings': settings})
|
context = RequestContext(request, {
|
||||||
|
'base_url': request.build_absolute_uri('/'),
|
||||||
|
'settings': settings
|
||||||
|
})
|
||||||
return render_to_response('index.html', context)
|
return render_to_response('index.html', context)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -351,10 +351,10 @@
|
||||||
"importPosterFrames": false
|
"importPosterFrames": false
|
||||||
},
|
},
|
||||||
"site": {
|
"site": {
|
||||||
"id": "{{settings.SITEID}}",
|
"id": "padma",
|
||||||
"name": "{{settings.SITENAME}}",
|
"name": "Pad.ma",
|
||||||
"sectionName": "{{settings.SITENAME}}",
|
"url": "pad.ma",
|
||||||
"url": "{{settings.URL}}"
|
"videoprefix": ""
|
||||||
},
|
},
|
||||||
"sitePages": [
|
"sitePages": [
|
||||||
{"id": "about", "title": "About"},
|
{"id": "about", "title": "About"},
|
||||||
|
|
|
@ -2,52 +2,21 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
# Django settings for pan.do/ra project defaults,
|
# Django settings for pan.do/ra project defaults,
|
||||||
# create local_settings.py to overwrite
|
# create local_settings.py to overwrite
|
||||||
|
# check pan.do/ra section below for relevant settings
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from os.path import join, normpath
|
from os.path import join, normpath
|
||||||
|
|
||||||
SITENAME = 'Pan.do/ra'
|
|
||||||
SITEID = 'pandora'
|
|
||||||
URL = 'pan.do/ra'
|
|
||||||
|
|
||||||
PROJECT_ROOT = os.path.normpath(os.path.dirname(__file__))
|
PROJECT_ROOT = os.path.normpath(os.path.dirname(__file__))
|
||||||
|
|
||||||
DEBUG = True
|
DEBUG = False
|
||||||
TEMPLATE_DEBUG = DEBUG
|
TEMPLATE_DEBUG = DEBUG
|
||||||
JSON_DEBUG = True
|
JSON_DEBUG = True
|
||||||
|
|
||||||
#with apache x-sendfile or lighttpd set this to True
|
#this gets set to all users in highest userLevel (app/config.py)
|
||||||
XSENDFILE = False
|
ADMINS = ()
|
||||||
|
|
||||||
#with nginx X-Accel-Redirect set this to True
|
|
||||||
XACCELREDIRECT = False
|
|
||||||
|
|
||||||
ADMINS = (
|
|
||||||
#('admin', 'admin@example.com'),
|
|
||||||
)
|
|
||||||
|
|
||||||
DEFAULT_FROM_EMAIL='system@' + URL.split('/')[0]
|
|
||||||
#DEFAULT_FROM_EMAIL='admin@example.com'
|
|
||||||
SERVER_EMAIL=DEFAULT_FROM_EMAIL
|
|
||||||
|
|
||||||
MANAGERS = ADMINS
|
MANAGERS = ADMINS
|
||||||
|
|
||||||
DATABASES = {
|
|
||||||
'default': {
|
|
||||||
'NAME': 'pandora',
|
|
||||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
|
||||||
'USER': 'pandora',
|
|
||||||
'PASSWORD': ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#rabbitmq connection settings
|
|
||||||
CELERY_RESULT_BACKEND = "database"
|
|
||||||
BROKER_HOST = "127.0.0.1"
|
|
||||||
BROKER_PORT = 5672
|
|
||||||
BROKER_USER = "pandora"
|
|
||||||
BROKER_PASSWORD = "box"
|
|
||||||
BROKER_VHOST = "/pandora"
|
|
||||||
SEND_CELERY_ERROR_EMAILS=False
|
|
||||||
|
|
||||||
|
|
||||||
# Local time zone for this installation. Choices can be found here:
|
# Local time zone for this installation. Choices can be found here:
|
||||||
|
@ -75,9 +44,6 @@ MEDIA_ROOT = normpath(join(PROJECT_ROOT, '..', 'data'))
|
||||||
STATIC_ROOT = normpath(join(PROJECT_ROOT, '..', 'static'))
|
STATIC_ROOT = normpath(join(PROJECT_ROOT, '..', 'static'))
|
||||||
TESTS_ROOT = join(PROJECT_ROOT, 'tests')
|
TESTS_ROOT = join(PROJECT_ROOT, 'tests')
|
||||||
|
|
||||||
#if videos are served from another subdomain
|
|
||||||
VIDEO_PREFIX = ''
|
|
||||||
|
|
||||||
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
||||||
# trailing slash if there is a path component (optional in other cases).
|
# trailing slash if there is a path component (optional in other cases).
|
||||||
# Examples: "http://media.lawrence.com", "http://example.com/media/"
|
# Examples: "http://media.lawrence.com", "http://example.com/media/"
|
||||||
|
@ -166,18 +132,41 @@ LOGGING = {
|
||||||
|
|
||||||
AUTH_PROFILE_MODULE = 'user.UserProfile'
|
AUTH_PROFILE_MODULE = 'user.UserProfile'
|
||||||
|
|
||||||
|
#=========================================================================
|
||||||
|
#Pan.do/ra related settings settings
|
||||||
|
#to customize, create local_settings.py and overwrite keys
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'NAME': 'pandora',
|
||||||
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||||
|
'USER': 'pandora',
|
||||||
|
'PASSWORD': ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#rabbitmq connection settings
|
||||||
|
CELERY_RESULT_BACKEND = "database"
|
||||||
|
BROKER_HOST = "127.0.0.1"
|
||||||
|
BROKER_PORT = 5672
|
||||||
|
BROKER_USER = "pandora"
|
||||||
|
BROKER_PASSWORD = "box"
|
||||||
|
BROKER_VHOST = "/pandora"
|
||||||
|
SEND_CELERY_ERROR_EMAILS=False
|
||||||
|
|
||||||
|
#with apache x-sendfile or lighttpd set this to True
|
||||||
|
XSENDFILE = False
|
||||||
|
|
||||||
|
#with nginx X-Accel-Redirect set this to True
|
||||||
|
XACCELREDIRECT = False
|
||||||
|
|
||||||
SITE_CONFIG = join(PROJECT_ROOT, '0xdb.jsonc')
|
SITE_CONFIG = join(PROJECT_ROOT, '0xdb.jsonc')
|
||||||
|
#used if CONFIG['video']['download'] is set
|
||||||
|
|
||||||
TRACKER_URL="http://url2torrent.net:6970/announce"
|
TRACKER_URL="http://url2torrent.net:6970/announce"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DATA_SERVICE = ''
|
DATA_SERVICE = ''
|
||||||
POSTER_PRECEDENCE = (
|
POSTER_PRECEDENCE = (
|
||||||
'piratecinema.org',
|
'piratecinema.org',
|
||||||
'local',
|
|
||||||
'criterion.com',
|
'criterion.com',
|
||||||
'wikipedia.org',
|
'wikipedia.org',
|
||||||
'impawards.com',
|
'impawards.com',
|
||||||
|
@ -187,8 +176,12 @@ POSTER_PRECEDENCE = (
|
||||||
'other'
|
'other'
|
||||||
)
|
)
|
||||||
|
|
||||||
#0xdb.org
|
USE_IMDB = False
|
||||||
USE_IMDB = True
|
|
||||||
|
#if you set PAROT in VIDEO_PREFIX make sure cookies work accros subsomains
|
||||||
|
VIDEO_PREFIX=''
|
||||||
|
#VIDEO_PREFIX='videoPART.example.com'
|
||||||
|
#SESSION_COOKIE_DOMAIN=*.example.com"
|
||||||
|
|
||||||
#copy scripts and adjust to customize
|
#copy scripts and adjust to customize
|
||||||
ITEM_POSTER = join('scripts', 'oxdb_poster')
|
ITEM_POSTER = join('scripts', 'oxdb_poster')
|
||||||
|
@ -196,7 +189,11 @@ ITEM_POSTER = join('scripts', 'oxdb_poster')
|
||||||
ITEM_ICON = join('scripts', 'item_icon')
|
ITEM_ICON = join('scripts', 'item_icon')
|
||||||
LIST_ICON = join('scripts', 'list_icon')
|
LIST_ICON = join('scripts', 'list_icon')
|
||||||
|
|
||||||
#overwrite default settings with local settings
|
|
||||||
|
#you can ignore things below this line
|
||||||
|
#=========================================================================
|
||||||
|
|
||||||
|
#load installation specific settings from local_settings.py
|
||||||
try:
|
try:
|
||||||
from local_settings import *
|
from local_settings import *
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<meta name="application-name" content="{{settings.SITENAME}}"/>
|
<meta name="application-name" content="{{settings.SITENAME}}"/>
|
||||||
<link rel="icon" href="/static/png/icon64.png" sizes="32x32"/>
|
<link rel="icon" href="/static/png/icon64.png" sizes="32x32"/>
|
||||||
<link rel="icon" href="/static/png/icon64.png" sizes="48x48"/>
|
<link rel="icon" href="/static/png/icon64.png" sizes="48x48"/>
|
||||||
<meta name="application-url" content="http://{{settings.URL}}"/>
|
<meta name="application-url" content="{{base_url}}"/>
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
if (typeof(console) == 'undefined') {
|
if (typeof(console) == 'undefined') {
|
||||||
console = {
|
console = {
|
||||||
|
|
Loading…
Reference in a new issue