我已经将Django项目上传到ubuntu服务器。并删除了项目文件夹中的所有迁移文件。我在本地主机上使用mysql,但在Ubuntu上安装了Postgresql。当我尝试迁移数据库时,django会引发如下错误。
python manage.py迁移结果
F File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/root/Virtual/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/root/Virtual/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/root/Virtual/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/root/Virtual/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 60, in execute
super().execute(*args, **options)
File "/root/Virtual/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/root/Virtual/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 95, in handle
self.run(**options)
File "/root/Virtual/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "/root/Virtual/lib/python3.7/site-packages/django/utils/autoreload.py", line 579, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "/root/Virtual/lib/python3.7/site-packages/django/utils/autoreload.py", line 564, in start_django
reloader.run(django_main_thread)
File "/root/Virtual/lib/python3.7/site-packages/django/utils/autoreload.py", line 272, in run
get_resolver().urlconf_module
File "/root/Virtual/lib/python3.7/site-packages/django/utils/functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/root/Virtual/lib/python3.7/site-packages/django/urls/resolvers.py", line 564, in urlconf_module
return import_module(self.urlconf_name)
File "/root/Virtual/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/root/Virtual/AdenOnline/AdenOnline/urls.py", line 13, in <module>
path('taskmanager/',include('taskmanager.urls') ),
File "/root/Virtual/lib/python3.7/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/root/Virtual/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/root/Virtual/AdenOnline/taskmanager/urls.py", line 6, in <module>
from .views import MainView,TaskDetailView,TaskListView
File "/root/Virtual/AdenOnline/taskmanager/views.py", line 107, in <module>
class TaskListView(ListView):
File "/root/Virtual/AdenOnline/taskmanager/views.py", line 110, in TaskListView
queryset = list(Task.objects.all().values('id','task_project','task_title','task_employee','task_employer','task_start_date','task_end_date','task_status','task_priorty'))
File "/root/Virtual/lib/python3.7/site-packages/django/db/models/query.py", line 274, in __iter__
self._fetch_all()
File "/root/Virtual/lib/python3.7/site-packages/django/db/models/query.py", line 1242, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/root/Virtual/lib/python3.7/site-packages/django/db/models/query.py", line 113, in __iter__
for row in compiler.results_iter(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size):
File "/root/Virtual/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1049, in results_iter
results = self.execute_sql(MULTI, chunked_fetch=chunked_fetch, chunk_size=chunk_size)
File "/root/Virtual/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1097, in execute_sql
cursor.execute(sql, params)
File "/root/Virtual/lib/python3.7/site-packages/django/db/backends/utils.py", line 99, in execute
return super().execute(sql, params)
File "/root/Virtual/lib/python3.7/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/root/Virtual/lib/python3.7/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/root/Virtual/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/root/Virtual/lib/python3.7/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/root/Virtual/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "taskmanager_task" does not exist
LINE 1: ...k_status", "taskmanager_task"."task_priorty" FROM "taskmanag...
这是因为我在服务器或Django上切换了PostgreSQL吗?任何想法和建议将不胜感激。非常感谢。