Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/core/management/__init__.py", line 425, in execute_from_command_line
utility.execute()
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/core/management/base.py", line 373, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/core/management/base.py", line 412, in execute
self.check()
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/core/management/base.py", line 438, in check
all_issues = checks.run_checks(
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/core/checks/registry.py", line 77, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/urls/resolvers.py", line 446, in check
for pattern in self.url_patterns:
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/urls/resolvers.py", line 632, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/urls/resolvers.py", line 625, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/apple/sanskar_handicrafts/sanskar_handicrafts/urls.py", line 23, in <module>
path('', include('website.urls')),
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/apple/sanskar_handicrafts/website/urls.py", line 2, in <module>
from . import views
File "/home/apple/sanskar_handicrafts/website/views.py", line 12, in <module>
for image in g_images:
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/db/models/query.py", line 280, in __iter__
self._fetch_all()
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/db/models/query.py", line 1354, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/db/models/query.py", line 51, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1202, in execute_sql
cursor.execute(sql, params)
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 99, in execute
return super().execute(sql, params)
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/apple/sanskar_handicrafts/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "website_gallery" does not exist
LINE 1: ...bsite_gallery"."id", "website_gallery"."img" FROM "website_g...
is the error I keep getting whenever I try to
runserver, makemigrations or migrate. Also when i run SELECT * FROM table_name for any table it tells me that it doesn't exist.
I've been following this tutorial and this guide
Stack overflow isn't really letting me post this because my post is 'too much code' so aaaaaaaaaaaaaaaaaaaaaaaa
CodePudding user response:
You probably have added a new model Gallery but after that you forgot to run makemigrations and migrate on the droplet. Then you added some code to a view function in website/views.py that tries to fetch Gallery models from the DB, but they are non-existing yet so Django gives the error.
To solve this issue, try to comment out every code line in the specific view function, which uses the Gallery model, then create/run migrations.
After that you can uncomment all the codes that use Gallery model, since the respective table is now present in the database, the query will be successful.
