steve254 steve254 - 1 year ago 129
Linux Question

Django, 1.9.10 Language matching query does not exist

I am a struggling beginner and I will appreciate your help.
I have cloned a Django site to edit and learn from it but I can not runserver.
On running server I get the error

Language matching query does not exist.
Request Method: GET
Request URL:
Django Version: 1.9.10
Exception Type: DoesNotExist
Exception Value:

Language matching query does not exist.
Exception Location: /home/steve/Documents/wger/venv-django/lib/python3.5/site-packages/django/db/models/ in get, line 387
Python Executable: /home/steve/Documents/wger/venv-django/bin/python
Python Version: 3.5.2
Python Path:

Server time: Mon, 24 Oct 2016 19:48:24 +0300

/home/steve/Documents/wger/wger-croners/wger/utils/ in load_language
language = Language.objects.get(short_name=used_language)

What could be wrong? I have followed all instructions on the Git readme.

Answer Source

It is because there is no entry in Language model where short_name equals to used_language. For details, read: Retrieve Object from Django Model

In case you want to create object with short_hand asused_language in case not found, use .get_or_create() instead as:

 language, is_created = Language.objects.get_or_create(short_name=used_language)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download