From 4fe7bab605bc4d2f073ab072831e07c3e8882d2a Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Sun, 1 Mar 2015 11:56:54 +0000 Subject: [PATCH] Fiexed nginx redirect --- TODO.md | 17 ++++++++++ orchestra/apps/domains/models.py | 37 +++++++++++---------- orchestra/management/commands/setupnginx.py | 2 +- 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/TODO.md b/TODO.md index 81ba8821..00da8559 100644 --- a/TODO.md +++ b/TODO.md @@ -188,3 +188,20 @@ Multi-tenant WebApps * username maximum as group user in UNIX * forms autocomplete="off" + + + +ln -s /proc/self/fd /dev/fd + + +* http-https/https-only/http-only + + +POST INSTALL +------------ + +* Generate a password-less ssh key, and copy it to the servers you want to orchestrate. +ssh-keygen +ssh-copy-id root@ + + diff --git a/orchestra/apps/domains/models.py b/orchestra/apps/domains/models.py index da164077..6d71592b 100644 --- a/orchestra/apps/domains/models.py +++ b/orchestra/apps/domains/models.py @@ -50,6 +50,26 @@ class Domain(models.Model): def subdomains(self): return Domain.objects.filter(name__regex='\.%s$' % self.name) + def clean(self): + self.name = self.name.lower() + + def save(self, *args, **kwargs): + """ create top relation """ + update = False + if not self.pk: + top = self.get_top() + if top: + self.top = top + self.account_id = self.account_id or top.account_id + else: + update = True + super(Domain, self).save(*args, **kwargs) + if update: + for domain in self.subdomains.exclude(pk=self.pk): + # queryset.update() is not used because we want to trigger backend to delete ex-topdomains + domain.top = self + domain.save(update_fields=['top']) + def get_description(self): if self.is_top: num = self.subdomains.count() @@ -167,23 +187,6 @@ class Domain(models.Model): value=record.value ) return result - - def save(self, *args, **kwargs): - """ create top relation """ - update = False - if not self.pk: - top = self.get_top() - if top: - self.top = top - self.account_id = self.account_id or top.account_id - else: - update = True - super(Domain, self).save(*args, **kwargs) - if update: - for domain in self.subdomains.exclude(pk=self.pk): - # queryset.update() is not used because we want to trigger backend to delete ex-topdomains - domain.top = self - domain.save(update_fields=['top']) class Record(models.Model): diff --git a/orchestra/management/commands/setupnginx.py b/orchestra/management/commands/setupnginx.py index 811b0b82..6c15a0e2 100644 --- a/orchestra/management/commands/setupnginx.py +++ b/orchestra/management/commands/setupnginx.py @@ -46,7 +46,7 @@ class Command(BaseCommand): 'server {\n' ' listen 80;\n' ' listen [::]:80 ipv6only=on;\n' - ' rewrite ^/$ /admin;\n' + ' rewrite ^/$ /admin/;\n' ' client_max_body_size 500m;\n' ' location / {\n' ' uwsgi_pass unix:///var/run/uwsgi/app/%(project_name)s/socket;\n'