Skip to content

Commit fa4353f

Browse files
committed
Merge branch 'multi-instance' into features/docker-apub
2 parents 08fbe08 + f44159a commit fa4353f

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ createDB:
4444
find . -path "*/migrations/*.pyc" -exec rm --force "{}" +
4545
make updatedb
4646
make migrate
47-
python3 manage.py loaddata initial_data
4847

4948
# Mise à jour des fichiers de langue
5049
lang:

pod/main/apps.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from django.utils.translation import gettext_lazy as _
88
from django.conf import settings
99
from django.core.exceptions import ObjectDoesNotExist
10+
from django.core.management import call_command
1011

1112
import json
1213

@@ -15,17 +16,16 @@
1516
PORT = os.getenv("POD_PORT", 8000)
1617

1718

18-
def init_site(sender, **kwargs):
19+
def load_data(sender, **kwargs):
1920
from django.contrib.sites.models import Site
2021

22+
call_command("loaddata", "initial_data.json")
23+
2124
domain = f"{INSTANCE}.localhost:{PORT}"
22-
Site.objects.update_or_create(
23-
id=settings.SITE_ID,
24-
defaults={
25-
"domain": domain,
26-
"name": domain,
27-
}
28-
)
25+
site, _ = Site.objects.update_or_create(id=settings.SITE_ID)
26+
site.domain = domain
27+
site.name = domain
28+
site.save()
2929

3030

3131
def create_missing_pages(sender, **kwargs) -> None:
@@ -178,4 +178,4 @@ def ready(self):
178178
post_migrate.connect(create_missing_conf, sender=self)
179179
post_migrate.connect(create_missing_pages, sender=self)
180180
post_migrate.connect(create_first_block, sender=self)
181-
post_migrate.connect(init_site, sender=self)
181+
post_migrate.connect(load_data, sender=self)

pod/main/fixtures/initial_data.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
[
2-
{
3-
"model": "sites.site",
4-
"pk": 1,
5-
"fields": {
6-
"domain": "pod.localhost:8000",
7-
"name": "pod.localhost:8000"
8-
}
9-
},
102
{
113
"pk": 1,
124
"model": "main.configuration",

0 commit comments

Comments
 (0)