You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2020/06/03 22:14:00 UTC
[airavata-django-portal] 01/02: Handle case where ALLOWED_HOSTS is
empty
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
commit 4d998ce1cfedb477a3d8c12b6bdd97269ccfeaf3
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Wed Jun 3 17:43:55 2020 -0400
Handle case where ALLOWED_HOSTS is empty
---
.../wagtailapps/base/management/commands/set_wagtail_site.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/django_airavata/wagtailapps/base/management/commands/set_wagtail_site.py b/django_airavata/wagtailapps/base/management/commands/set_wagtail_site.py
index 84db3a0..914858b 100644
--- a/django_airavata/wagtailapps/base/management/commands/set_wagtail_site.py
+++ b/django_airavata/wagtailapps/base/management/commands/set_wagtail_site.py
@@ -13,7 +13,8 @@ from django_airavata.wagtailapps.base.models import (
class Command(BaseCommand):
def handle(self, **options):
- hostname = settings.ALLOWED_HOSTS[0]
+ hostname = settings.ALLOWED_HOSTS[0] if len(
+ settings.ALLOWED_HOSTS) > 0 else "localhost"
if not Site.objects.filter(hostname=hostname,
is_default_site=True).exists():
with transaction.atomic():