Fiexed nginx redirect
This commit is contained in:
parent
d601773bf3
commit
4fe7bab605
17
TODO.md
17
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@<server-address>
|
||||
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
@ -168,23 +188,6 @@ class Domain(models.Model):
|
|||
)
|
||||
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):
|
||||
""" Represents a domain resource record """
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in New Issue