Browse Source

adapt to (not so) new settings.DATABASES layout

Natenom/support-murmur-13-1446181288462
Michael Ziegler 13 years ago
parent
commit
31bfc717d0
  1. 10
      pyweb/mumble/management/__init__.py

10
pyweb/mumble/management/__init__.py

@ -28,11 +28,11 @@ from update_schema import update_schema
from server_detect import find_existing_instances from server_detect import find_existing_instances
if settings.DATABASE_ENGINE == "sqlite3":
if settings.DATABASES["default"]["ENGINE"] == "django.db.backends.sqlite3":
# Move the DB to the db subdirectory if necessary. # Move the DB to the db subdirectory if necessary.
oldpath = join( settings.MUMBLE_DJANGO_ROOT, "mumble-django.db3" ) oldpath = join( settings.MUMBLE_DJANGO_ROOT, "mumble-django.db3" )
if not exists( settings.DATABASE_NAME ) and exists( oldpath ):
move( oldpath, settings.DATABASE_NAME )
if not exists( settings.DATABASES["default"]["NAME"] ) and exists( oldpath ):
move( oldpath, settings.DATABASES["default"]["NAME"] )
cursor = connection.cursor() cursor = connection.cursor()
@ -47,9 +47,9 @@ else:
uptodate = True uptodate = True
if not uptodate: if not uptodate:
if settings.DATABASE_ENGINE == "sqlite3":
if settings.DATABASE["default"]["ENGINE"] == "django.db.backends.sqlite3":
# backup the db before the conversion. # backup the db before the conversion.
copy( settings.DATABASE_NAME, settings.DATABASE_NAME+".bak" )
copy( settings.DATABASES["default"]["NAME"], settings.DATABASES["default"]["NAME"]+".bak" )
signals.post_syncdb.connect( update_schema, sender=models ) signals.post_syncdb.connect( update_schema, sender=models )
else: else:
signals.post_syncdb.connect( find_existing_instances, sender=models ) signals.post_syncdb.connect( find_existing_instances, sender=models )

Loading…
Cancel
Save