在apache服务器

时间:2017-07-17 09:57:14

标签: angular production-environment

要在服务器上部署我的角度应用,我运行以下命令:ng build --prod。但是在我得到的dist文件夹中,我没有index.html文件。我想知道复制和粘贴我拥有的index.html文件是否是最佳做法,或者是否还有其他我缺失的文件。

angular-cli.json

{
  "project": {
    "version": "1.0.0-beta.28.3",
    "name": "main"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "../../target/frontend",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.json",
      "prefix": "app",
      "styles": [
        "styles.css"
      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "files": "src/**/*.ts",
      "project": "src/tsconfig.json"
    },
    {
      "files": "e2e/**/*.ts",
      "project": "e2e/tsconfig.json"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "css",
    "prefixInterfaces": false,
    "inline": {
      "style": false,
      "template": false
    },
    "spec": {
      "class": false,
      "component": true,
      "directive": true,
      "module": false,
      "pipe": true,
      "service": true
    }
  }
}

1 个答案:

答案 0 :(得分:1)

这一行
<img width="600px" height ="400px" id='the_img_1' src='http://127.0.0.1:5000/video_feed'> 建议您的代码是在"outDir": "../../target/frontend",文件夹中生成的,而不是在target\frontend文件夹中生成的。如果要将其更改为dist。将该行更改为 来自dist

"outDir": "dist",