dlareau / puzzlehunt_server

Server for Puzzle hunts run by Puzzlehunt CMU, but can be repurposed for other hunts.
MIT License
19 stars 16 forks source link

"Hunt matching query does not exist" on new docker setup #155

Closed nro-bot closed 3 years ago

nro-bot commented 3 years ago

Hello, I'm evaluating if this is suitable for running some testsolving. I have followed instructions https://puzzlehunt-server.readthedocs.io/en/latest/setup.html

However on 1. running docker-compose up and 2. going to localhost or localhost/staff, after enabling debug, I receive error

Hunt matching query does not exist.

See following screenshot of full error message:

Screenshot from 2021-02-22 19-09-41


My .env file contains

DB_NAME=puzzlehunt_db
DB_PASSWORD=[...]
DB_USER=puzzleuser
DJANGO_SECRET_KEY=[...]
DOMAIN=localhost
CONTACT_EMAIL=sample_email@example.com
PROJECT_NAME=puzzlehunt_site

DJANGO_ENABLE_DEBUG=True

In text form:

On enable debug using .env I receive traceback:


Environment:

Request Method: GET
Request URL: http://app:8000/

Django Version: 2.2.13
Python Version: 3.7.10
Installed Applications:
('bootstrap_admin',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'django.contrib.sites',
 'django.contrib.flatpages',
 'huntserver',
 'crispy_forms',
 'huey.contrib.djhuey')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware')

Traceback:

File "/usr/local/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)

File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/code/huntserver/info_views.py" in index
  17.     curr_hunt = Hunt.objects.get(is_current_hunt=True)

File "/usr/local/lib/python3.7/site-packages/django/db/models/manager.py" in manager_method
  82.                 return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/usr/local/lib/python3.7/site-packages/django/db/models/query.py" in get
  408.                 self.model._meta.object_name

Exception Type: DoesNotExist at /
Exception Value: Hunt matching query does not exist.

I can include full debug if helpful.

dlareau commented 3 years ago

Thanks for your interest!

Sorry about the troubles, there is a part of the setup documentation that has been missing for a bit and "hasn't been an issue because *I* know what to do..." 🤦

Anyway, run the following commands and all should be good:

docker-compose exec app python3 /code/manage.py collectstatic --noinput
docker-compose exec app python3 /code/manage.py loaddata initial_hunt

I have also added the commands as a "step 6" to the readme.md, I'll get it into the readthedocs soon hopefully.

nro-bot commented 3 years ago

Oh whoa, thanks for the fast response! Banged on my head on it for a bit, went to dinner, came back to solution. Works great, thanks!