Skip to content

Commit

Permalink
Fix migration order issue for clean installations
Browse files Browse the repository at this point in the history
  • Loading branch information
dlareau committed Mar 20, 2020
1 parent f0e8153 commit 7521018
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ services:

huey:
image: django_puzzlehunt # re-use above image
command: bash -c "python /code/manage.py migrate --no-input && python /code/manage.py run_huey --quiet"
command: >
bash -c "python /code/manage.py migrate sites --no-input &&
python /code/manage.py migrate --no-input &&
python /code/manage.py run_huey --quiet"
restart: always
volumes:
- .:/code
Expand Down
8 changes: 4 additions & 4 deletions huntserver/migrations/0054_auto_20200318_2145.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

from django.db import migrations
from django.template.loader import get_template
from django.contrib.sites.models import Site


def setup_pages(apps, schema_editor):
FlatPage = apps.get_model('flatpages', 'FlatPage')
Site = apps.get_model('sites', 'Site')

source = get_template("contact_us.html").template.source.split("</readme> -->")[1]
fp = FlatPage.objects.create(url='/contact-us/', title='Contact Us', content=source)
fp.sites.add(1)
fp.sites.add(Site.objects.get(pk=1))

source = get_template("resources.html").template.source.split("</readme> -->")[1]
fp = FlatPage.objects.create(url='/extra/resources/', title='Resources', content=source)
fp.sites.add(1)
fp.sites.add(Site.objects.get(pk=1))

source = get_template("hunt_info.html").template.source.split("</readme> -->")[1]
fp = FlatPage.objects.create(url='/hunt-info/', title='Current Hunt Info', content=source)
fp.sites.add(1)
fp.sites.add(Site.objects.get(pk=1))
return


Expand Down

0 comments on commit 7521018

Please sign in to comment.