Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/344.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Travis CI Django构建失败_Python_Django_Postgresql_Travis Ci - Fatal编程技术网

Python Travis CI Django构建失败

Python Travis CI Django构建失败,python,django,postgresql,travis-ci,Python,Django,Postgresql,Travis Ci,在过去的几天里,我一直在与Travis CI合作,以自动运行我的测试用例。然而,我无法让它工作 在本地运行我的测试用例非常有效。我使用命令: python manage.py test myApp 我的travis.yml文件如下 language: python os: linux python: - "3.5.2" services: postgresql install: - pip install -r requirements.txt script: - py

在过去的几天里,我一直在与Travis CI合作,以自动运行我的测试用例。然而,我无法让它工作

在本地运行我的测试用例非常有效。我使用命令:

python manage.py test myApp
我的travis.yml文件如下

language: python

os: linux

python:
 - "3.5.2"

services: postgresql


install:

 - pip install -r requirements.txt

script: 

 - python manage.py test myApp
我不断地发现这个错误:

django.db.utils.ProgrammingError: column myApp_userdocument.createdOn does not exist

在运行脚本之前,我尝试过运行migrate,但没有成功。我的travis文件有什么明显的问题吗?

您可以尝试
makemigrations
。仅运行migrate不会帮助您,您还必须运行
makeigrations

script: 

 - python manage.py makemigrations
 - python manage.py migrate
 - python manage.py test myApp
PS:如果您有SQLite数据库,则只有迁移才能工作

编辑:在执行
makeigrations


请阅读有关设置postgres和提供凭据的信息。

谢谢,我将尝试一下,并将向您汇报!我现在得到这个错误:django.db.utils.OperationalError:FATAL:数据库“Test”不存在,但看起来是朝着正确的方向迈出的一步!哦,对了。您还必须在postgres中创建数据库,然后运行makemigrations。我会更新答案,请稍候。谢谢!我将进行编辑,阅读您发送给我的链接,然后重试。
before_script:
  - psql -c 'create database travis_ci_test;' -U postgres