Answer the question
In order to leave comments, you need to log in
Site matching query does not exist when trying to run tests?
Trying to do
[email protected]2fd625d222bb:/app# ./manage.py test
Creating test database for alias 'default'...
Got an error creating the test database: database "test_app" already exists
Type 'yes' if you would like to try deleting the test database 'test_app', or 'no' to cancel: yes
Destroying old test database for alias 'default'...
__fake__.DoesNotExist: Site matching query does not exist.
>>> from django.contrib.sites.models import Site
>>> Site.objects.all()
<QuerySet [<Site: mysite.ru>]>
>>> Site.objects.first().pk
1
settings.py
SITE_ID = 1
Answer the question
In order to leave comments, you need to log in
So the Test database is empty, you must first create an entry in it, and then pull it. The base in dzhanga is cleared after each test.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question