【问题标题】:manage.py flush not working during testingmanage.py flush 在测试期间不起作用
【发布时间】:2019-03-21 10:25:08
【问题描述】:

我正在使用有关如何使用Django Rest - React and it has some testing in it too 的教程。当我测试它时,错误来了:

CypressError: cy.exec('npm run dev') timed out after waiting 60000ms.

因为这个错误发生在“before all”钩子中,我们跳过了当前套件中的剩余测试:“Django REST framework / Rea...”

下面是package.json的一部分,

{
  "name": "django-drf-react-quickstart",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "flush": "pipenv run python ./project/manage.py flush --no-input",
    "e2e": "cypress open --project ./project/frontend/",
    "dev": "webpack --mode development ./project/frontend/src/index.js --output ./project/frontend/static/frontend/main.js",
    "build": "webpack --mode production ./project/frontend/src/index.js --output ./project/frontend/static/frontend/main.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },

我认为问题出在同花顺部分。我使用 virtualenv 并且尝试了许多组合,例如:

  1. 运行 python ./project/manage.py flush --no-input

  2. virtualenv 运行 python ./project/manage.py flush --no-input

  3. python ./project/manage.py flush --no-input

我什至尝试安装 pipenv,但没有用。请帮我解决这个问题。

【问题讨论】:

    标签: python django virtualenv pipenv


    【解决方案1】:

    我在本教程中遇到了类似的问题,帮助我的是首先安装 pipenv,然后明确说明它和 python 的路径:

    "flush": "./project_virtenv/bin/pipenv run ./project_virtenv/bin/python ./project/manage.py flush --no-input",

    【讨论】:

      猜你喜欢
      • 2015-10-03
      • 2011-03-03
      • 1970-01-01
      • 2022-08-17
      • 1970-01-01
      • 2011-08-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多