Heroku上でコードハイライトのページへアクセスすると「undefined method `Py_IsInitialized' for RubyPython::Python:Module」エラーとなります。。(heroku logsにて確認)
おそらくStack Overflowに上がっている下記の質問とほぼ同じ事象かと思われます。。
ruby on rails 3.1 - How to use Pygments.rb on Heroku? - Stack Overflow
ruby - undefined method `Py_IsInitialized' for RubyPython::Python:Module - Stack Overflow
◆環境情報
ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin10.8.0]rails -v
Rails 3.2.6heroku info
=== markdown-sample
Addons: Shared Database 5MB
Domain Name: markdown-sample.herokuapp.com
Git URL: git@heroku.com:markdown-sample.git
Owner: xxxxxxxxxx@gmail.com
Repo Size: 9M
Slug Size: 14M
Stack: cedar
Web URL: http://markdown-sample.herokuapp.com/◆関連コード
Gemfile
# For Markdown
gem 'redcarpet'
gem "pygments.rb", "~> 0.2.13"app/controllers/application_controller.rb
private
#---------------#
# show_markdown #
#---------------#
def show_markdown( text )
html_render = HtmlWithPygments.new( hard_wrap: true, filter_html: true )
markdown = Redcarpet::Markdown.new( html_render, autolink: true, fenced_code_blocks: true )
return markdown.render( text )
end
helper_method :show_markdownapp/models/html_with_pygments.rb
# coding: utf-8
class HtmlWithPygments < Redcarpet::Render::HTML
#------------#
# block_code #
#------------#
def block_code( code, language )
Pygments.highlight( code, lexer: language, options: { encoding: 'utf-8' } )
end
endapp/views/pages/show.html.erb
<%= raw show_markdown( @page.content ) %>◆各URL
Herokuデプロイ済みサイト
GitHubソースコード
アプリケーション作成手順
何か解決法はありますでしょうか?
