2017-10-20 90 views
0

我是作曲家和Heroku雲中的新手,這裏有一個關於作曲家路徑的可能是愚蠢的問題。Heroku上Wordpress + Composer的路徑問題

我試圖部署在Heroku上一個WordPress,代碼/指令在這裏以下:https://github.com/ellefsen/wordpress-heroku-php

在概念上,我應該使用S3存儲任何媒體內容。但是,我的情況非常特別:現在和將來,我的網站上有兩張且只有兩張圖片。所以我:

  1. 刪除了所有S3相關的代碼和configs;
  2. 在public/content/uploads /添加兩張圖片:public/content/uploads/2016/08/one.png和public/content/uploads/2016/08/another.png;
  3. 相應地調整.gitignore(刪除公共/內容/上傳);
  4. 修改composer.json爲:
     "extra": { 
     
         "webroot-dir": "public/wp", 
     
         "webroot-package": "wordpress", 
     
         "installer-paths": { 
     
          "public/content/plugins/{$name}/": [ 
     
          "type:wordpress-plugin" 
     
          ], 
     
          "public/content/mu-plugins/{$name}/": [ 
     
          "type:wordpress-muplugin" 
     
          ], 
     
          "public/content/uploads/{$name}/": [ 
     
          "public/wp/wp-content/uploads/{$name}" 
     
          ], 
     
          "public/content/themes/{$name}/": [ 
     
          "type:wordpress-theme" 
     
          ] 
     
         } 
     
         },

對於項 「公共/內容/上傳/ {$名稱} /」,我想:

  • 公共/ WP/wp-content/uploads/{$ name}
  • wp-content/uploads/{$ name}

但無論如何,在WP儀表板中,我看不到媒體庫中的任何圖像。有人能幫我一下嗎?謝謝!

回答

1

只要您只處理兩張圖片,我就不會在WP中的媒體庫中煩惱。把它們放在你的主題目錄中,直接引用它們。

這樣你就不必處理S3或Heroku的臨時文件存儲,因爲它們都將被提交併作爲項目的一部分包含在存儲庫中。

+0

謝謝Kim!絕對是你的提案將工作,幾乎完美的我的情況。但是,您能否也請教我爲什麼我的解決方案失敗?我渴望知道根本原因。再次感謝! – Sheng

+0

沒問題。要在媒體庫中查看媒體,必須通過wp-admin界面上傳媒體,以便將它們存儲在數據庫中。從上傳目錄中獲取它們不會使它們被WP識別。 – ellefsen

+0

感謝您的詳細解釋! – Sheng