2016-09-04 8 views
4

jekyllを使って個人的なブログを構築しました。すべてがローカルホスト上でうまく動作します。私はgithubに展開したくない。私はいくつかの理由でGoogleのアプリケーションエンジンのホスティングを好む。Google App Engineにjekyllをホストする

私はオンラインのいくつかの指示に従い、_siteフォルダをGoogleアプリケーションエンジンプロジェクトにコピーしました。

app.yamlがどのように見えるか、これは次のとおりです。

application: myblog 
version: 1 
runtime: python27 
api_version: 1 
threadsafe: yes 

error_handlers: 
- file: /404.html 

handlers: 

- url:/
    static_files: _site/index.html 
    upload: _site/index.html 

- url: /(.*) 
    static_files: _site/\1 
    upload: _site/(.*) 


libraries: 
- name: webapp2 
    version: "2.5.2" 

私がGoogleのApp Engine上でローカルに実行し、唯一のindex.htmlや他のいくつかのファイルが表示されます。他のページはページが見つからないことを示します。私が正しく実装していないものはありますか?

+1

ためexampleを参照してください。バケツにドメイン名を割り当てることができます –

答えて

1

さて、私はついにそれを理解します。とにかく少しトリックです。

あなた_config.yaml fileアドオンで初:その後

permalink:   /posts/:title/index.html 

_siteフォルダ内の静的ファイルを生成するjekyll serveを実行します。投稿フォルダをアプリエンジンプロジェクトの_site /にコピーします。

その後、へご_config.yaml file変更パーマリンクで:

permalink:   /posts/:title 

実行jekyll serve_siteの静的ファイルを生成します。生成されたファイル全体をpostsフォルダを除く)をコピーして、あなたのアプリエンジンプロジェクトにコピーしてください。

そして、あなたのAppEngineは次のようにやや見えるapp.yamlを作る:それはちょうど、静的なウェブサイト、それがストレージに展開する方が簡単ですかどう

application: myblog 
version: 1 
runtime: python27 
api_version: 1 
threadsafe: yes 


handlers: 
- url: /(.*\.js) 
    mime_type: text/javascript 
    static_files: _site/\1 
    upload: _site/(.*\.js) 

- url: /(.*\.(jpg|png|ico)) 
    static_files: _site/\1 
    upload: _site/(.*\.img) 

- url: /(.*\.css) 
    mime_type: text/css 
    static_files: _site/\1 
    upload: _site/(.*\.css) 

- url: /(.*\.(eot|svg|svgz|otf|ttf|woff|woff2)) 
    static_files: _site/\1 
    upload: _site/(.*\.fonts) 

- url:/
    static_files: _site/index.html 
    upload: _site/index.html 

- url: /(.+)/ 
    static_files: _site/\1/index.html 
    upload: _site/(.+)/index.html 
    expiration: "15m" 

- url: /(.+) 
    static_files: _site/\1/index.html 
    upload: _site/(.+)/index.html 
    expiration: "15m" 

- url: /(.*) 
    static_files: _site/\1 
    upload: _site/(.*) 

#- url: /((tags)|(archive)|(about)|(posts)|(fonts))/ 

libraries: 
- name: webapp2 
    version: "2.5.2" 

は、ところで明確化