Is it possible to upload a simple html and javascript file structure to heroku?

前端 未结 10 1551
逝去的感伤
逝去的感伤 2020-12-04 06:25

I\'m trying to deploy an open source project of mine to heroku, it is by necessity very simple with just static html and javascript. But do they not support static sites?

10条回答
  •  醉梦人生
    2020-12-04 06:51

    A simple way is to masquerade the HTML app as a PHP App. Heroku properly identifies PHP apps.

    1. Rename your index.html file to home.html.
    2. Create an index.php file and include your entry html file. If your HTML entry file is named home.html as recommended, your index.php should look like:

    3. In your command line on the machine you are pushing from, type:

      git add .
      git commit -m 'your commit message'
      git push heroku master

    Heroku should properly detect your app now as a php app:

    -----> PHP app detected
    -----> Bundling Apache version 2.2.22
    -----> Bundling PHP version 5.3.10
    -----> Discovering process types
           Procfile declares types -> (none)
           Default types for PHP   -> web
    
    -----> Compiled slug size: 9.9MB
    -----> Launching... done, v3
    ...
    

    Mad Thanks to lemiffe for his blog post: http://www.lemiffe.com/how-to-deploy-a-static-page-to-heroku-the-easy-way/

提交回复
热议问题