aboutsummaryrefslogtreecommitdiff
path: root/rpki/django_settings/common.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-10-25 22:25:40 +0000
committerRob Austein <sra@hactrn.net>2015-10-25 22:25:40 +0000
commit2c749a18db7886b7c9931f2b98eac6f099d304d2 (patch)
treeb4fb16f74a8e5ada8e84add05ef94d865c427383 /rpki/django_settings/common.py
parent95ef1c6d040c015615be01bee36547faf8432791 (diff)
Tweak binary field types to get SQLite3 working as a Django ORM
backend. Switch yamltest's default database configuration to sqlite3. MySQL still has character set issues, which are almost certainly to do with the communication channel rather than the database tables. It's possible that one of the newer DB API drivers for MySQL fixes this, might be worth trying one of them at some point (see the "MySQL notes" discussion of MySQL DB API drivers in the Django documentation). svn path=/branches/tk705/; revision=6149
Diffstat (limited to 'rpki/django_settings/common.py')
-rw-r--r--rpki/django_settings/common.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/rpki/django_settings/common.py b/rpki/django_settings/common.py
index ef386cf0..d2fe496c 100644
--- a/rpki/django_settings/common.py
+++ b/rpki/django_settings/common.py
@@ -56,11 +56,17 @@ if os.getenv("RPKI_DJANGO_DEBUG") == "yes":
class DatabaseConfigurator(object):
+ default_sql_engine = "mysql"
+
def configure(self, cfg, section):
self.cfg = cfg
self.section = section
- return dict(default = getattr(self, cfg.get("sql-engine", section = section, default = "mysql"))())
+ engine = cfg.get("sql-engine", section = section,
+ default = self.default_sql_engine)
+ return dict(
+ default = getattr(self, engine))
+ @property
def mysql(self):
return dict(
ENGINE = "django.db.backends.mysql",
@@ -70,21 +76,23 @@ class DatabaseConfigurator(object):
#
# Using "latin1" here is totally evil and wrong, but
# without it MySQL 5.6 (and, probably, later versions)
- # whine incessantly about bad UTF-8 characters when one
- # stores ASN.1 DER in BLOB columns. Which makes no
- # freaking sense at all, but this is MySQL, which has a
- # character set management interface from hell, so good
- # luck with that. If anybody really understands how to
- # fix this, tell me; for now, we force MySQL to revert to
- # the default behavior in MySQL 5.5.
+ # whine incessantly about bad UTF-8 characters in BLOB
+ # columns. Which makes no freaking sense at all, but this
+ # is MySQL, which has the character set management interface
+ # from hell, so good luck with that. If anybody really
+ # understands how to fix this, tell me; for now, we force
+ # MySQL to revert to the default behavior in MySQL 5.5.
#
- OPTIONS = dict(charset = "latin1"))
+ #OPTIONS = dict(charset = "latin1")
+ )
+ @property
def sqlite3(self):
return dict(
ENGINE = "django.db.backends.sqlite3",
NAME = cfg.get("sql-database", section = self.section))
+ @property
def postgresql(self):
return dict(
ENGINE = "django.db.backends.postgresql_psycopg2",