Closed kampsj closed 10 months ago
is there nothing else in the logs when running docker-compose logs -f
?
What is your setup (compose, env, ...) ?
I'm running Tandoor with docker. My compose and .env file are listed below. Both files are hardly modified from the ones you provided (I added an extra volume and changed some passwords). I tried upgrading my installation with both an older backup (one I made before a previous upgrade) and the latest. Both give a 500 error when searching.
I checked the logs again, and below are the only entries when performing a search:
web_recipes_1 | 2021-02-20T11:16:35.103535589Z 172.21.0.2 - - [20/Feb/2021:11:16:35 +0000] "GET /search/?csrfmiddlewaretoken=PgriO2FhjZ6MWRToPTaMihPjL4reGE3OsDKQtnc3Q08qzkkgCYmqolnleHcOzY0P&name=b&internal=unknown HTTP/1.0" 500 145 "http://192.168.1.16:8080/search/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:85.0) Gecko/20100101 Firefox/85.0"
nginx_recipes_1 | 2021-02-20T11:16:35.357843072Z 192.168.1.3 - - [20/Feb/2021:11:16:35 +0000] "GET /favicon.ico HTTP/1.1" 499 0 "http://192.168.1.16:8080/search/?csrfmiddlewaretoken=PgriO2FhjZ6MWRToPTaMihPjL4reGE3OsDKQtnc3Q08qzkkgCYmqolnleHcOzY0P&name=b&internal=unknown" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:85.0) Gecko/20100101 Firefox/85.0" "-"
docker-compose.yml:
version: "3"
services:
db_recipes:
restart: always
image: postgres:11-alpine
volumes:
- ./postgresql:/var/lib/postgresql/data
env_file:
- ./.env
web_recipes:
image: vabene1111/recipes
restart: always
env_file:
- ./.env
volumes:
- ./staticfiles:/opt/recipes/staticfiles
- ./mediafiles:/opt/recipes/mediafiles
- ./db_backup:/opt/recipes/db_backup
depends_on:
- db_recipes
nginx_recipes:
image: nginx:mainline-alpine
restart: always
ports:
- 8080:8080
env_file:
- ./.env
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d
- ./staticfiles:/static
- ./mediafiles:/media
- ./db_backup:/db_backup
.env:
# only set this to true when testing/debugging
# when unset: 1 (true) - dont unset this, just for development
DEBUG=0
# hosts the application can run under e.g. recipes.mydomain.com,cooking.mydomain.com,...
ALLOWED_HOSTS=*
# random secret key, use for example base64 /dev/urandom | head -c50 to generate one
SECRET_KEY=[redacted]
# add only a database password if you want to run with the default postgres, otherwise change settings accordingly
DB_ENGINE=django.db.backends.postgresql_psycopg2
POSTGRES_HOST=db_recipes
POSTGRES_PORT=5432
POSTGRES_USER=djangodb
POSTGRES_PASSWORD=[boop]
POSTGRES_DB=djangodb
# Users can set a amount of time after which the shopping list is refreshed when they are in viewing mode
# This is the minimum interval users can set. Setting this to low will allow users to refresh very frequently which
# might cause high load on the server. (Technically they can obviously refresh as often as they want with their own scripts)
SHOPPING_MIN_AUTOSYNC_INTERVAL=5
# If staticfiles are stored at a different location uncomment and change accordingly
# STATIC_URL=/static/
# If mediafiles are stored at a different location uncomment and change accordingly
# MEDIA_URL=/media/
# Serve mediafiles directly using gunicorn. Basically everyone recommends not doing this. Please use any of the examples
# provided that include an additional nxginx container to handle media file serving.
# If you know what you are doing turn this back on (1) to serve media files using djangos serve() method.
# when unset: 1 (true) - this is temporary until an appropriate amount of time has passed for everyone to migrate
GUNICORN_MEDIA=0
# allow authentication via reverse proxy (e.g. authelia), leave of if you dont know what you are doing
# docs: https://github.com/vabene1111/recipes/tree/develop/docs/docker/nginx-proxy%20with%20proxy%20authentication
# when unset: 0 (false)
REVERSE_PROXY_AUTH=0
# the default value for the user preference 'comments' (enable/disable commenting system)
# when unset: 1 (true)
COMMENT_PREF_DEFAULT=1
other then the search viewing and everything is working ?
can you turn on debug mode and see if there is any additional information ?
Yes, I've been only experiencing problems with the search function.
I've pasted the full traceback below:
Environment:
Request Method: GET
Request URL: http://localhost/search/?csrfmiddlewaretoken=17LJ2dVld266ueVTMXgzMGGmCtaM5RfTadHoq4gpogpBtqi78nxqsTMU7g3BA6l8&name=a&internal=unknown
Django Version: 3.1.6
Python Version: 3.8.7
Installed Applications:
['dal',
'dal_select2',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.sites',
'django.contrib.staticfiles',
'django_tables2',
'django_filters',
'crispy_forms',
'emoji_picker',
'rest_framework',
'rest_framework.authtoken',
'django_cleanup.apps.CleanupConfig',
'webpack_loader',
'django_js_reverse',
'allauth',
'allauth.account',
'allauth.socialaccount',
'cookbook.apps.CookbookConfig']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'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.locale.LocaleMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback (most recent call last):
File "/opt/recipes/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/recipes/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/recipes/cookbook/views/views.py", line 60, in search
table = RecipeTable(f.qs)
File "/opt/recipes/venv/lib/python3.8/site-packages/django_filters/filterset.py", line 243, in qs
qs = self.filter_queryset(qs)
File "/opt/recipes/venv/lib/python3.8/site-packages/django_filters/filterset.py", line 230, in filter_queryset
queryset = self.filters[name].filter(queryset, value)
File "/opt/recipes/venv/lib/python3.8/site-packages/django_filters/filters.py", line 779, in __call__
return self.method(qs, self.f.field_name, value)
File "/opt/recipes/cookbook/filters.py", line 48, in filter_name
queryset = queryset \
File "/opt/recipes/venv/lib/python3.8/site-packages/django/db/models/query.py", line 942, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "/opt/recipes/venv/lib/python3.8/site-packages/django/db/models/query.py", line 962, in _filter_or_exclude
clone._filter_or_exclude_inplace(negate, *args, **kwargs)
File "/opt/recipes/venv/lib/python3.8/site-packages/django/db/models/query.py", line 969, in _filter_or_exclude_inplace
self._query.add_q(Q(*args, **kwargs))
File "/opt/recipes/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1358, in add_q
clause, _ = self._add_q(q_object, self.used_aliases)
File "/opt/recipes/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1377, in _add_q
child_clause, needed_inner = self.build_filter(
File "/opt/recipes/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1237, in build_filter
return self._add_q(
File "/opt/recipes/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1377, in _add_q
child_clause, needed_inner = self.build_filter(
File "/opt/recipes/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1319, in build_filter
condition = self.build_lookup(lookups, col, value)
File "/opt/recipes/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1150, in build_lookup
lhs = self.try_transform(lhs, name)
File "/opt/recipes/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1198, in try_transform
raise FieldError(
Exception Type: FieldError at /search/
Exception Value: Unsupported lookup 'unaccent' for CharField or join on the field not permitted.
ah ok, that is very interesting, it says that the unaccent method is not allowed which is weired because you use the postgresql backend.
Is there anything special with your database setup that you could think of that could cause this isssue ?
Just to be sure could you try setting this environment variable instead of your pyscop2
DB_ENGINE=django.db.backends.postgresql
I dont really understand why the issue is coming up for you and not other installations, have you maybe changed some settings on the postgres database ?
I haven't made any changes to the postgres database, I'm just using the default setup. The error popped up after updating to 0.14.2.
I just changed the DB_ENGINE as you said and the search function is working again! Thanks a bunch!
that is very interesting because according to the documentation what you had in there before (and what i provided as a default for quite a while) should be a synonym for the new value. But good to know that this is not the case and that this issue can be solved this way.
i will update the docs and system cheching page accordingly and leave this issue open to remeber doing so
I can confirm the fix to the issue. Had the same issue and the change to the env variable fixed the problem.
Version
Version: 0.14.2 (just upgraded my docker installation)
Bug description
Using the basic search results in a Server Error (500) message. I can still, however, use the advance search to search using ingredients or tags. Searching for nothing does not produce an error message.
Below are two relevant log lines, though they do not seem helpful.