Fill the ALLOWED_HOSTS variable for new installations.

see #384
This commit is contained in:
Antoine Nguyen
2013-05-22 17:33:35 +02:00
parent 4884c2b5fb
commit ff3e329382
3 changed files with 10 additions and 1 deletions
+4 -1
View File
@@ -96,11 +96,14 @@ class DeployCommand(Command):
amavis_conn = t.render(Context(self.ask_db_info('amavis'))) if parsed_args.with_amavis \
else None
allowed_host = raw_input('Under which domain do you want to deploy modoboa? ')
mod = __import__(parsed_args.name, globals(), locals(), ['settings'])
tpl = self._render_template("%s/settings.py" % self._templates_dir, {
'default_conn' : default_conn, 'amavis_conn' : amavis_conn,
'secret_key' : mod.settings.SECRET_KEY,
'name' : parsed_args.name, 'django14' : django14
'name' : parsed_args.name, 'django14' : django14,
'allowed_host': allowed_host
})
fp = open("%s/settings.py" % path, "w")
fp.write(tpl)
+4
View File
@@ -11,6 +11,10 @@ ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
ALLOWED_HOSTS = [
'{{ allowed_host }}',
]
MANAGERS = ADMINS
DATABASES = { {{ default_conn|safe }}
+2
View File
@@ -52,6 +52,8 @@ class DeployTest(unittest.TestCase):
child.sendline(self.dbuser)
child.expect("Password:", timeout=timeout)
child.sendline(self.dbpassword)
child.expect("Under which domain do you want to deploy modoboa?", timeout=timeout)
child.sendline("localhost")
child.wait()
fout.close()
self.assertEqual(child.exitstatus, 0)