Reputation: 315
I have been using the app platform for almost 2 months. Yesterday, I made some changes in database tables (models) in my Django projects. I pushed those changes to Github and my app successfully redeployed. But When I open the site, I got “ProgrammingError” that some field that I created new in the existing table does not exist. So, I opened the console in App Platform and applied migrations but nothing is changed. I am still facing the error.
Here is the full traceback:
Traceback (most recent call last): File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params)
The above exception (column products_subcategory.description does not exist LINE 1: ...subcategory"."id", "products_subcategory"."name", "products_... ^ ) was the direct cause of the following exception: File "/workspace/.heroku/python/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view return self.dispatch(request, *args, **kwargs) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/views/generic/base.py", line 98, in dispatch return handler(request, *args, **kwargs) File "/workspace/lavisco/views.py", line 40, in get return render(request, 'lavisco/index.html', context) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/shortcuts.py", line 19, in render content = loader.render_to_string(template_name, context, request, using=using) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/loader.py", line 62, in render_to_string return template.render(context, request) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/backends/django.py", line 61, in render return self.template.render(context) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 170, in render return self._render(context) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 162, in _render return self.nodelist.render(context) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 938, in render bit = node.render_annotated(context) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 905, in render_annotated return self.render(context) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/loader_tags.py", line 150, in render return compiled_parent._render(context) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 162, in _render return self.nodelist.render(context) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 938, in render bit = node.render_annotated(context) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 905, in render_annotated return self.render(context) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/loader_tags.py", line 192, in render return template.render(context) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 172, in render return self._render(context) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 162, in _render return self.nodelist.render(context) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 938, in render bit = node.render_annotated(context) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 905, in render_annotated return self.render(context) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/defaulttags.py", line 311, in render if match: File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/models/query.py", line 291, in bool self._fetch_all() File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/models/query.py", line 1308, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/models/query.py", line 53, in iter results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1156, in execute_sql cursor.execute(sql, params) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 98, in execute return super().execute(sql, params) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 66, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers return executor(sql, params, many, context) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/utils.py", line 90, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params)
Exception Type: ProgrammingError at / Exception Value: column products_subcategory.description does not exist LINE 1: ...subcategory"."id", "products_subcategory"."name", "products_...
Upvotes: 0
Views: 349
Reputation: 249
Here are few possible solutions:
Inspect Database: Maybe you are using a database which you didn't
intent to use, i.e. you may have changed database_url mistakenly in
your .env/configuration. Another case can be using django-configuration and passing wrong configuration to be used
--configuration=Local
instead of --configuration=Production
Try migrating the database specifying app-name i.e python manage.py makemigrations project_management
.
Check if you added application into installed apps or may have mistakenly removed from installed apps list.
Upvotes: 0