--- /dev/null
+from django.conf import settings as django_settings
+
+def get_database_engine():
+ try:
+ database_type = django_settings.DATABASE_ENGINE
+
+ if len(database_type) == 0:
+ raise Exception('Empty old style database engine')
+ except:
+ try:
+ database_type = django_settings.DATABASES['default']['ENGINE']
+ except:
+ database_type = 'unknown'
+
+ return str(database_type)
\ No newline at end of file
+from forum.base import get_database_engine
+
+database_type = get_database_engine()
PG_MIGRATION_QUERY = """
SELECT id AS user_ptr_id, is_approved, email_isvalid, email_key, reputation, gravatar, gold, silver, bronze, questions_per_page, last_seen, real_name, website, location, date_of_birth, about, hide_ignored_questions, tag_filter_setting INTO forum_user FROM auth_user;
class Command(NoArgsCommand):
def handle_noargs(self, **options):
- if settings.DATABASE_ENGINE in ('postgresql_psycopg2', 'postgresql', ):
+ if database_type.__contains__('postgresql'):
migration_query = PG_MIGRATION_QUERY
fkeys_query = PG_FKEYS_QUERY
- elif settings.DATABASE_ENGINE == 'mysql':
+ elif database_type.__contains__('mysql'):
migration_query = MYSQL_MIGRATION_QUERY
fkeys_query = MYSQL_FKEYS_QUERY
else:
+from forum.base import get_database_engine
+database_type = get_database_engine()
+
NAME = 'Mysql Full Text Search'
DESCRIPTION = "Enables Mysql full text search functionality."
try:
import MySQLdb
import settings_local
- CAN_USE = settings_local.DATABASE_ENGINE in ('mysql', 'pooled_mysql')
+ CAN_USE = 'mysql' in database_type
except Exception, e:
import traceback
traceback.print_exc()
CAN_USE = False
-
\ No newline at end of file
+from forum.base import get_database_engine
+database_type = get_database_engine()
+
NAME = 'Postgresql Full Text Search'
DESCRIPTION = "Enables PostgreSql full text search functionality."
try:
import psycopg2
- from django.conf import settings
- CAN_USE = settings.DATABASE_ENGINE in ('postgresql_psycopg2', 'postgresql', )
+ CAN_USE = 'postgresql' in database_type
except:
CAN_USE = False
-
\ No newline at end of file
from xml.dom.minidom import parse, parseString
+from forum.startup import get_database_engine
from forum.models import Question, User
from forum.settings import APP_URL, SVN_REVISION, APP_TITLE, APP_DESCRIPTION
from django import VERSION as DJANGO_VERSION
admin_emails_xml += '<email value="%s" />' % email
admin_emails_xml += '</emails>'
+ database_type = get_database_engine()
+
statistics = """<check>
<key value="%(site_key)s" />
<app_url value="%(app_url)s" />
'active_users' : get_active_users(),
'python_version' : ''.join(sys.version.splitlines()),
'django_version' : str(DJANGO_VERSION),
- 'database' : django_settings.DATABASE_ENGINE,
+ 'database' : database_type,
'os' : str(os.uname()),
'emails' : admin_emails_xml,
}
INTERNAL_IPS = ('127.0.0.1',)
-DATABASE_NAME = '' # Or path to database file if using sqlite3.
-DATABASE_USER = '' # Not used with sqlite3.
-DATABASE_PASSWORD = '' # Not used with sqlite3.
-DATABASE_ENGINE = '' #mysql, etc
-DATABASE_HOST = ''
-DATABASE_PORT = ''
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.mysql',
+ 'NAME': 'osqa',
+ 'USER': 'root',
+ 'PASSWORD': '',
+ 'HOST': '',
+ 'PORT': '',
+ }
+}
CACHE_BACKEND = 'file://%s' % os.path.join(os.path.dirname(__file__),'cache').replace('\\','/')
#CACHE_BACKEND = 'dummy://'