aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2016-05-06 16:00:40 +0300
committerFilipp Lepalaan <filipp@mac.com>2016-05-06 16:00:40 +0300
commitbb1fa8e854882e60909386ddade466981ce65c02 (patch)
treecc76f7f85ef47a804e711845e7d5768094152d9f
parent11e9f35220017062d2d09649354174c955f3caa0 (diff)
downloadServo-bb1fa8e854882e60909386ddade466981ce65c02.tar.gz
Servo-bb1fa8e854882e60909386ddade466981ce65c02.tar.bz2
Servo-bb1fa8e854882e60909386ddade466981ce65c02.zip
Fix django.core.exceptions.AppRegistryNotReady
-rwxr-xr-xinstall.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/install.py b/install.py
index 9d12b45..6c3ac6d 100755
--- a/install.py
+++ b/install.py
@@ -2,11 +2,14 @@
import os
import socket
+import django
import requests
from string import Template
from subprocess import call
default_hostname = socket.gethostname()
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
+
tpl_url = 'https://gist.githubusercontent.com/filipp/cba2ffecd0d5790f7245/raw/'
fh = open('local_settings.py', 'w')
@@ -39,8 +42,6 @@ call(['createdb', args['dbname'], '-O', args['dbuser'], '-U', args['dbadmin']])
fh.write(s)
fh.close()
-loc = {}
-
print("** Setting up database tables **")
call(['./manage.py', 'migrate'])
call(['psql', '-c', 'ALTER SEQUENCE servo_order_id_seq RESTART WITH 12345', args['dbname'], args['dbuser']])
@@ -48,6 +49,8 @@ call(['psql', '-c', 'ALTER SEQUENCE servo_order_id_seq RESTART WITH 12345', args
print("** Creating Super User **")
call(['./manage.py', 'createsuperuser'])
+loc = {}
+django.setup() # To avoid django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
print("** Creating initial Service Location **")
loc['title'] = raw_input('1/6 Name [PretendCo Inc]: ') or 'PretendCo Inc'
loc['email'] = raw_input('2/6 Email [service@pretendo.com]: ') or 'service@pretendo.com'