2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

Change database syntax to modern format as old style no longer

supported in django 1.4
This commit is contained in:
Wookey 2013-07-02 18:13:27 +01:00
parent 69c3a06c98
commit 7759e481d4
4 changed files with 42 additions and 30 deletions

View File

@ -11,20 +11,20 @@ from django.core.urlresolvers import reverse
from core.models import Cave, Entrance
import flatpages.models
databasename=settings.DATABASES['default']['NAME']
def reload_db():
if settings.DATABASE_ENGINE == 'sqlite3':
if settings.DATABASES['default']['ENGINE'] == 'django.db.backends.sqlite3':
try:
os.remove(settings.DATABASE_NAME)
os.remove(databasename)
except OSError:
pass
else:
cursor = connection.cursor()
cursor.execute("DROP DATABASE %s" % settings.DATABASE_NAME)
cursor.execute("CREATE DATABASE %s" % settings.DATABASE_NAME)
cursor.execute("ALTER DATABASE %s CHARACTER SET=utf8" % settings.DATABASE_NAME)
cursor.execute("USE %s" % settings.DATABASE_NAME)
cursor.execute("DROP DATABASE %s" % databasename)
cursor.execute("CREATE DATABASE %s" % databasename)
cursor.execute("ALTER DATABASE %s CHARACTER SET=utf8" % databasename)
cursor.execute("USE %s" % databasename)
management.call_command('syncdb', interactive=False)
user = User.objects.create_user('expo', 'goatchurch@gmail.com', 'gosser')
user.is_staff = True

View File

@ -1,12 +1,16 @@
import sys
sys.path.append("/home/expo/troggle")
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'troggle' # Or path to database file if using sqlite3.
DATABASE_USER = 'undemocracy' # Not used with sqlite3.
DATABASE_PASSWORD = 'aiGohsh5' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'troggle', # Or path to database file if using sqlite3.
'USER': 'expo', # Not used with sqlite3.
'PASSWORD': 'gosser', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
REPOS_ROOT_PATH = '/home/expo/'
sys.path.append(REPOS_ROOT_PATH)

View File

@ -1,12 +1,16 @@
import sys
# link localsettings to this file for use on expo computer in austria
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'troggle' # Or path to database file if using sqlite3.
DATABASE_USER = 'expo' # Not used with sqlite3.
DATABASE_PASSWORD = 'gosser' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'troggle', # Or path to database file if using sqlite3.
'USER': 'expo', # Not used with sqlite3.
'PASSWORD': 'gosser', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
REPOS_ROOT_PATH = '/home/expo/expofiles/'
@ -21,12 +25,12 @@ TUNNEL_DATA = REPOS_ROOT_PATH + 'tunneldata/'
CAVERN = 'cavern'
THREEDTOPOS = '3dtopos'
EXPOWEB = REPOS_ROOT_PATH + 'expoweb/'
SURVEYS = '/home/expo/'
SURVEYS = REPOS_ROOT_PATH
SURVEY_SCANS = REPOS_ROOT_PATH + 'expoimages/'
FILES = REPOS_ROOT_PATH + 'expoimages'
PYTHON_PATH = '/home/expo/expofiles/troggle/'
PYTHON_PATH = REPOS_ROOT_PATH + 'hg/troggle/'
#URL_ROOT = 'http://127.0.0.1:8000'
URL_ROOT = "http://expoweb/"
@ -36,17 +40,17 @@ EXPOWEB_URL = '/'
SURVEYS_URL = '/survey_scans/'
MEDIA_URL = URL_ROOT + DIR_ROOT + '/site_media/'
MEDIA_ROOT = '/home/expo/expofiles/troggle/media/'
MEDIA_ROOT = REPOS_ROOT_PATH + '/troggle/media/'
MEDIA_ADMIN_DIR = '/usr/lib/python2.4/site-packages/django/contrib/admin/media/'
TINY_MCE_MEDIA_ROOT = '/usr/share/tinymce/www/'
TINY_MCE_MEDIA_URL = URL_ROOT + DIR_ROOT + '/tinymce_media/'
TEMPLATE_DIRS = (
"/home/expo/expofiles/troggle/templates",
PYTHON_PATH + "templates",
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
LOGFILE = '/home/expo/expofiles/troggle/parsing_log.txt'
LOGFILE = PYTHON_PATH + 'parsing_log.txt'

View File

@ -1,9 +1,13 @@
DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = '' # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'troggle', # Or path to database file if using sqlite3.
'USER': 'expo', # Not used with sqlite3.
'PASSWORD': 'gosser', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
SURVEX_DATA = 'c:\\Expo\\loser\\'
CAVERN = 'cavern'