我在部署django2.2项目到阿里云ECS上去,实例安装好了。然后按以下步骤进行:
1、安装虚拟环境:按教程已经成功。也建立了虚拟环境。
2、安装nginx:成功,可以看到初始页面;
3、安装postgresql10.11 for ubuntu18.04,按教程弄好了一切;
4、安装uwsgi:也能成功输出页面:Hello world.
5、上传项目文件到服务器后,就出了问题,我觉得问题可能是 migrations.
我的环境是:ubuntu18.04+nginx1.14+postgresql10+uwsgi2.18+python3.6.9+django2.2.9
异常如下:
ProgrammingError at /
relation "file_filetype" does not exist
LINE 1: ...id", "file_filetype"."file_type_chinesename" FROM "file_file...
^
Request Method: GET
Request URL:
Django Version: 2.2
Exception Type: ProgrammingError
Exception Value:
relation "file_filetype" does not exist
LINE 1: ...id", "file_filetype"."file_type_chinesename" FROM "file_file...
^
Exception Location: /home/tsfs/.virtualenvs/tsfswork/lib/python3.6/site-packages/django/db/backends/utils.py in _execute, line 84
Python Executable: /home/tsfs/.virtualenvs/tsfswork/bin/uwsgi
Python Version: 3.6.9
Python Path:
['.',
'',
'/home/tsfs/.virtualenvs/tsfswork/lib/python36.zip',
'/home/tsfs/.virtualenvs/tsfswork/lib/python3.6',
'/home/tsfs/.virtualenvs/tsfswork/lib/python3.6/lib-dynload',
'/usr/lib/python3.6',
'/home/tsfs/.virtualenvs/tsfswork/lib/python3.6/site-packages']
Server time: Sun, 23 Feb 2020 21:26:27 +0800
ProgrammingError at / relation "file_filetype" does not exist
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- 憧憬blog 2023-03-15 03:14关注
根据错误提示,你遇到了一个ProgrammingError,在执行SQL语句时,PostgreSQL数据库无法找到一个名为"file_filetype"的关系(relation)。根据你提供的信息,这可能是由于项目中的migrations没有正确迁移导致的。
我建议你运行以下命令,尝试在PostgreSQL中同步数据库:
python manage.py makemigrations python manage.py migrate
这将确保任何在Django项目中定义的模型都正确同步到PostgreSQL数据库中。完成后,重新部署代码并重启uwsgi服务,看看是否解决了问题。
解决 无用评论 打赏 举报