我正在尝试将我的一个开源项目部署到heroku上,它必然非常简单,只有静态的html和javascript。但是它们不支持静态站点吗?如果我不打算只使用html和javascript,我就不想把它变成Sinatra项目。
~/sites/d4-site $ heroku create --stack cedar
Creating quiet-ice-4769... done, stack is cedar
http://quiet-ice-4769.herokuapp.com/ | git@heroku.com:quiet-ice-4769.git
Git remote heroku added
~/sites/d4-site $ git remote -v
heroku git@heroku.com:quiet-ice-4769.git (fetch)
heroku git@heroku.com:quiet-ice-4769.git (push)
~/sites/d4-site $ git push heroku master
Counting objects: 53, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (49/49), done.
Writing objects: 100% (53/53), 206.08 KiB, done.
Total 53 (delta 4), reused 0 (delta 0)
-----> Heroku receiving push
-----> Removing .DS_Store files
! Heroku push rejected, no Cedar-supported app detected
发布于 2012-05-11 20:36:12
您可以使用rack来执行以下操作:
https://devcenter.heroku.com/articles/static-sites-on-heroku
或者你可以使用像Octopress/Jekyll这样的东西,她使用sinatra。
但是您需要一个最小的堆栈来提供html静态内容。
发布于 2016-10-15 04:36:14
这里有一个更优雅的方法:只需添加一个名为package.json
的文件,该文件将告诉Heroku使用harp作为服务器:
{
"name": "my-static-site",
"version": "1.0.0",
"description": "This will load any static html site",
"scripts": {
"start": "harp server --port $PORT"
},
"dependencies": {
"harp": "*"
}
}
然后部署到Heroku。完成了!
发布于 2015-10-29 20:18:46
以下是对我有效的方法:
cd myProject
git init
heroku create myApp
heroku git:remote -a myApp
如果入口点是main.html
,则使用下面一行内容创建index.php
:
<?php include_once("main.html"); ?>
然后执行以下步骤:
echo '{}' > composer.json
git add .
git commit -am "first commit"
git push heroku master
转到http://myApp.herokuapp.com/,你的应用程序现在应该是在线的。
https://stackoverflow.com/questions/10551273
复制相似问题