Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Commit

Permalink
updated to use newer django db config (closed turnkeylinux/tracker#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
alonswartz committed Sep 3, 2013
1 parent a25aefa commit 165ea77
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 7 deletions.
8 changes: 2 additions & 6 deletions conf.d/main
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,8 @@ $MYSQL_ADMIN create $DB_NAME --default-character-set=utf8;
$MYSQL_BATCH --execute "grant all privileges on $DB_NAME.* to $DB_USER@localhost identified by '$DB_PASS'; flush privileges;"

CONF=$WEBROOT/settings_local.py
mv $WEBROOT/settings_local.py.dist $CONF
sed -i "s|DATABASE_NAME.*|DATABASE_NAME = '$DB_NAME'|" $CONF
sed -i "s|DATABASE_USER.*|DATABASE_USER = '$DB_USER'|" $CONF
sed -i "s|DATABASE_PASSWORD.*|DATABASE_PASSWORD = '$DB_PASS'|" $CONF
sed -i "s|DATABASE_ENGINE.*|DATABASE_ENGINE = 'mysql'|" $CONF
sed -i "s|PASSWORD.*|PASSWORD\': \'$DB_PASS\',|" $CONF
sed -i "s|APP_URL.*|APP_URL = 'http://$DOMAIN'|" $CONF
chmod 640 $CONF

# populate database
cd $WEBROOT
Expand Down Expand Up @@ -74,6 +69,7 @@ rm $TWEAKS
chmod +x $WEBROOT/manage.py
rm -rf $WEBROOT/cron
rm $WEBROOT/osqa.wsgi.dist
rm $WEBROOT/settings_local.py.dist
rm $WEBROOT/rmpyc
rm $WEBROOT/log/django.osqa.log

Expand Down
2 changes: 1 addition & 1 deletion overlay/usr/lib/inithooks/firstboot.d/20regen-osqa-secrets
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ sed -i "s|SECRET_KEY.*|SECRETKEY = '$(mcookie)$(mcookie)'|" $CONF

CONF=/var/www/osqa/settings_local.py
PASSWORD=$(mcookie)
sed -i "s|DATABASE_PASSWORD.*|DATABASE_PASSWORD = '$PASSWORD'|" $CONF
sed -i "s|PASSWORD.*|PASSWORD\': \'$PASSWORD\',|" $CONF
$INITHOOKS_PATH/bin/mysqlconf.py --user=osqa --pass="$PASSWORD"

55 changes: 55 additions & 0 deletions overlay/usr/local/src/osqa.overlay/settings_local.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# encoding:utf-8
import os.path

SITE_SRC_ROOT = os.path.dirname(__file__)
LOG_FILENAME = 'django.osqa.log'

#for logging
import logging
logging.basicConfig(
filename=os.path.join(SITE_SRC_ROOT, 'log', LOG_FILENAME),
level=logging.ERROR,
format='%(pathname)s TIME: %(asctime)s MSG: %(filename)s:%(funcName)s:%(lineno)d %(message)s',
)

#ADMINS and MANAGERS
ADMINS = ()
MANAGERS = ADMINS

DEBUG = False
DEBUG_TOOLBAR_CONFIG = {
'INTERCEPT_REDIRECTS': True
}
TEMPLATE_DEBUG = DEBUG
INTERNAL_IPS = ('127.0.0.1',)

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'osqa',
'USER': 'osqa',
'PASSWORD': 'dbpass',
}
}

CACHE_BACKEND = 'file://%s' % os.path.join(os.path.dirname(__file__),'cache').replace('\\','/')
#CACHE_BACKEND = 'dummy://'
SESSION_ENGINE = 'django.contrib.sessions.backends.db'

# This should be equal to your domain name, plus the web application context.
# This shouldn't be followed by a trailing slash.
# I.e., http://www.yoursite.com or http://www.hostedsite.com/yourhostapp
APP_URL = 'http://www.example.com'

#LOCALIZATIONS
TIME_ZONE = 'America/New_York'

#OTHER SETTINGS

USE_I18N = True
LANGUAGE_CODE = 'en'

DJANGO_VERSION = 1.1
OSQA_DEFAULT_SKIN = 'default'

DISABLED_MODULES = ['books', 'recaptcha', 'project_badges']

0 comments on commit 165ea77

Please sign in to comment.