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

tryng django 1.7 recommended change syncdb to migrate

This commit is contained in:
Philip Sargent 2020-05-13 22:13:18 +01:00
parent 876cd8909f
commit 0338889905

View File

@ -16,7 +16,6 @@ import json
# NOTE databaseRest.py is *imported* by views_other.py as it is used in the control panel
# presented there.
databasename=settings.DATABASES['default']['NAME']
expouser=settings.EXPOUSER
expouserpass=settings.EXPOUSERPASS
expouseremail=settings.EXPOUSER_EMAIL
@ -43,7 +42,7 @@ def syncuser():
"""Sync user - needed after reload
"""
print("Synchronizing user")
management.call_command('syncdb', interactive=False)
management.call_command('migrate', interactive=False)
user = User.objects.create_user(expouser, expouseremail, expouserpass)
user.is_staff = True
user.is_superuser = True
@ -262,7 +261,7 @@ class JobQueue():
self.memdumpsql()
self.saveprofiles()
else:
django.db.close_old_connections() # needed if MySQL running
django.db.close_old_connections() # needed if MySQL running?
# run all the imports through :memory: first
settings.DATABASES['default']['ENGINE'] = 'django.db.backends.sqlite3'
settings.DATABASES['default']['NAME'] = ":memory:"
@ -287,6 +286,9 @@ class JobQueue():
# the jobque may not start from scratch so we need to initialise the db properly first
# because we are using an empty :memory: database
# But initiating twice crashes, so be sure to do it once only.
# Damn. syncdb() is still calling MySQL somehow **conn_params not sqlite3. So crashes on expo server.
if ("reinit",reinit_db) not in self.queue:
reinit_db()
if ("dirsredirect",dirsredirect) not in self.queue: