简体   繁体   English

如何将HTML部署到heroku?

[英]How to deploy HTML to heroku?

I have home.html file, basically it's the whole source code of HTML. 我有home.html文件,基本上它是HTML的整个源代码。 I also have index.php : <?php include_once("home.html"); ?> 我也有index.php<?php include_once("home.html"); ?> <?php include_once("home.html"); ?> . <?php include_once("home.html"); ?> It keeps on saying language is not detected. 它一直说未检测到语言。

! No default language could be detected for this app. 无法为此应用检测到默认语言。 HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically. 提示:当Heroku无法检测到要自动用于该应用程序的buildpack时,会发生这种情况。 See https://devcenter.heroku.com/articles/buildpacks ! 参见https://devcenter.heroku.com/articles/buildpacks Push failed 推送失败

To answer the question in your title, Heroku isn't really suited to hosting only static HTML. 为了回答标题中的问题,Heroku并不真正适合仅托管静态HTML。 It is designed for running web applications , not web sites . 它是为运行Web 应用程序而不是网站而设计的 I don't think Heroku even has an HTML-only buildpack, and I would strongly advise using another host for that purpose. 我不认为Heroku甚至没有仅HTML的buildpack,因此我强烈建议为此目的使用其他主机。 There are many options for hosting static HTML at very low cost. 有很多选项可以以非常低的成本托管静态HTML。

However, it sounds like what you actually want is to host PHP. 但是,听起来您真正想要的是托管PHP。 Initially, Heroku's build process attempts to detect the language of your application using some basic heuristics and then uses an appropriate buildpack . 最初,Heroku的构建过程尝试使用一些基本的启发式方法检测应用程序的语言,然后使用适当的buildpack (After it detects a buildpack once that buildpack will be used again in the future.) (一旦它检测到一个buildpack,该buildpack将在将来再次使用。)

To get Heroku to detect a PHP application you must include a composer.json file in the root directory of your project : 为了让Heroku检测PHP应用程序,您必须在项目的根目录中包含composer.json文件

Heroku PHP Support will be applied to applications only when the application has a file named composer.json in the root directory. 仅当应用程序在根目录中具有名为composer.json的文件时,才会将Heroku PHP Support应用于应用程序。 Even if an application has no Composer dependencies, it must include an empty composer.json in order to be recognized as a PHP application. 即使应用程序没有Composer依赖关系,它也必须包含一个空的composer.json才能被识别为PHP应用程序。

If you are using Composer to manage dependencies, you must also include your composer.lock file. 如果使用Composer来管理依赖项,则还必须包括composer.lock文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM