Итак, я только что отправил обновление на веб-сервер и сделал makemigrations
, затем migrate
, и все кажется нормальным, затем, когда я обновляю страницу веб-сайта, я получил эту ошибку
Traceback:
Environment:
Request Method: GET
Request URL: http://0.0.0.0/
Django Version: 2.0.2
Python Version: 3.5.2
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'HomePage',
'widget_tweaks',
'Cart']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'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']
Template error:
In template /home/django/LovelyMemory/HomePage/templates/HomePage/base.html, error at line 8
column HomePage_product.category_id does not exist
LINE 1: SELECT "HomePage_product"."id", "HomePage_product"."category...
^
1 : {% load static %}
2 : <!DOCTYPE html>
3 : <html lang="en">
4 :
5 : <head>
6 : <meta charset="utf-8">
7 : <meta http-equiv="X-UA-Compatible" content="IE=edge">
8 : <meta name="viewport" content="width =device-width, initial-scale= 1">
9 :
10 : <title>{% block title %} Lovely Memory {% endblock %}</title>
11 :
12 : <link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}"/>
13 : <link href="https://stackpath.bootstrapcdn.com/bootswatch/4.1.1/minty/bootstrap.min.css " rel="stylesheet"
14 : integrity="sha384- 4eGtnTOp6je5m6l1Zcp2WUGR9Y7kJZuAiD3Pk2GAW3uNRgHQSIqcrcAxBipzlbWP" crossorigin="anonymous">
15 : <script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
16 : <!--[if lt IE 9]>
17 : <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
18 : <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
Traceback:
File "/home/django/venv/lib/python3.5/site- packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)
The above exception (column HomePage_product.category_id does not exist
LINE 1: SELECT "HomePage_product"."id", "HomePage_product"."category...
^
) was the direct cause of the following exception:
File "/home/django/venv/lib/python3.5/site- packages/django/core/handlers/exception.py" in inner
35. response = get_response(request)
File "/home/django/venv/lib/python3.5/site- packages/django/core/handlers/base.py" in _get_response
128. response = self.process_exception_by_middleware(e, request)
File "/home/django/venv/lib/python3.5/site- packages/django/core/handlers/base.py" in _get_response
126. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/django/LovelyMemory/HomePage/views.py" in product_list
25. return render(request, 'HomePage/list.html', context)
File "/home/django/venv/lib/python3.5/site-packages/django/shortcuts.py" in render
36. content = loader.render_to_string(template_name, context, request, using=using)
File "/home/django/venv/lib/python3.5/site- packages/django/template/loader.py" in render_to_string
62. return template.render(context, request)
File "/home/django/venv/lib/python3.5/site- packages/django/template/backends/django.py" in render
61. return self.template.render(context)
File "/home/django/venv/lib/python3.5/site-packages/django/template/base.py" in render
175. return self._render(context)
File "/home/django/venv/lib/python3.5/site-packages/django/template/base.py" in _render
167. return self.nodelist.render(context)
File "/home/django/venv/lib/python3.5/site-packages/django/template/base.py" in render
943. bit = node.render_annotated(context)
File "/home/django/venv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
910. return self.render(context)
File "/home/django/venv/lib/python3.5/site- packages/django/template/loader_tags.py" in render
155. return compiled_parent._render(context)
File "/home/django/venv/lib/python3.5/site-packages/django/template/base.py" in _render
167. return self.nodelist.render(context)
File "/home/django/venv/lib/python3.5/site-packages/django/template/base.py" in render
943. bit = node.render_annotated(context)
File "/home/django/venv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
910. return self.render(context)
File "/home/django/venv/lib/python3.5/site-packages/django/template/loader_tags.py" in render
67. result = block.nodelist.render(context)
File "/home/django/venv/lib/python3.5/site-packages/django/template/base.py" in render
943. bit = node.render_annotated(context)
File "/home/django/venv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
910. return self.render(context)
File "/home/django/venv/lib/python3.5/site-packages/django/template/defaulttags.py" in render
168. len_values = len(values)
File "/home/django/venv/lib/python3.5/site-packages/django/db/models/query.py" in __len__
254. self._fetch_all()
File "/home/django/venv/lib/python3.5/site-packages/django/db/models/query.py" in _fetch_all
1179. self._result_cache = list(self._iterable_class(self))
File "/home/django/venv/lib/python3.5/site-packages/django/db/models/query.py" in __iter__
53. results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/home/django/venv/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
1064. cursor.execute(sql, params)
File "/home/django/venv/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
100. return super().execute(sql, params)
File "/home/django/venv/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
68. return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/home/django/venv/lib/python3.5/site-packages/django/db/backends/utils.py" in _execute_with_wrappers
77. return executor(sql, params, many, context)
File "/home/django/venv/lib/python3.5/site-packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)
File "/home/django/venv/lib/python3.5/site-packages/django/db/utils.py" in __exit__
89. raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/django/venv/lib/python3.5/site-packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)
Exception Type: ProgrammingError at /
Exception Value: column HomePage_product.category_id does not exist
LINE 1: SELECT "HomePage_product"."id", "HomePage_product"."category...
^
Таким образом, я удалил все предыдущие миграции и даже flush
базу данных, и эта ошибка все еще включена
Моя настройка:
Django (2.0.2)
gunicorn (19.7.1)
PostgreSQL
есть мысли о том, как решить эту проблему?
этомиграция
Это моя папка миграций