forked from expo/troggle
tryng django 1.7 recommended change syncdb to migrate
This commit is contained in:
parent
876cd8909f
commit
0338889905
@ -16,7 +16,6 @@ import json
|
|||||||
# NOTE databaseRest.py is *imported* by views_other.py as it is used in the control panel
|
# NOTE databaseRest.py is *imported* by views_other.py as it is used in the control panel
|
||||||
# presented there.
|
# presented there.
|
||||||
|
|
||||||
databasename=settings.DATABASES['default']['NAME']
|
|
||||||
expouser=settings.EXPOUSER
|
expouser=settings.EXPOUSER
|
||||||
expouserpass=settings.EXPOUSERPASS
|
expouserpass=settings.EXPOUSERPASS
|
||||||
expouseremail=settings.EXPOUSER_EMAIL
|
expouseremail=settings.EXPOUSER_EMAIL
|
||||||
@ -43,7 +42,7 @@ def syncuser():
|
|||||||
"""Sync user - needed after reload
|
"""Sync user - needed after reload
|
||||||
"""
|
"""
|
||||||
print("Synchronizing user")
|
print("Synchronizing user")
|
||||||
management.call_command('syncdb', interactive=False)
|
management.call_command('migrate', interactive=False)
|
||||||
user = User.objects.create_user(expouser, expouseremail, expouserpass)
|
user = User.objects.create_user(expouser, expouseremail, expouserpass)
|
||||||
user.is_staff = True
|
user.is_staff = True
|
||||||
user.is_superuser = True
|
user.is_superuser = True
|
||||||
@ -262,7 +261,7 @@ class JobQueue():
|
|||||||
self.memdumpsql()
|
self.memdumpsql()
|
||||||
self.saveprofiles()
|
self.saveprofiles()
|
||||||
else:
|
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
|
# run all the imports through :memory: first
|
||||||
settings.DATABASES['default']['ENGINE'] = 'django.db.backends.sqlite3'
|
settings.DATABASES['default']['ENGINE'] = 'django.db.backends.sqlite3'
|
||||||
settings.DATABASES['default']['NAME'] = ":memory:"
|
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
|
# the jobque may not start from scratch so we need to initialise the db properly first
|
||||||
# because we are using an empty :memory: database
|
# because we are using an empty :memory: database
|
||||||
# But initiating twice crashes, so be sure to do it once only.
|
# 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:
|
if ("reinit",reinit_db) not in self.queue:
|
||||||
reinit_db()
|
reinit_db()
|
||||||
if ("dirsredirect",dirsredirect) not in self.queue:
|
if ("dirsredirect",dirsredirect) not in self.queue:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user