2016-05-06 7 views
1

私のウェブサイトにEthereumを統合する際に問題があります。javacriptのsrcパスを指定する

1)次のスクリプトは、必要なファイルを指定します。変更されるファイルはyourCouncil.htmlで、必要なファイルはdirs bignumberとdistにあります。

[email protected]:/data/project/first_mvp/poll/templates/poll# ls 
#about.html#  connection.html  council_login.html~ img    logout.html~   thankYou.html 
about.html   connection.html~  councilView.html  landingPage.html old_files   thankYou.html~ 
about.html~  contractorView.html dist     landingPage.html~ #rating.html#  to_integrate 
bignumber   contractorView.html~ feedback.html  login_style1.css survey_details.html yourCouncil.html 
#connection.html# council_login.html feedback.html~  logout.html  survey.html   yourCouncil.html~ 
[email protected]:/data/project/first_mvp/poll/templates/poll# emacs yourCouncil.html 

これらを含めるためのコードは、エラーメッセージが

Not found: /your_council/dist/web3-light.js 
Not found: /your_council/bignumber/bignumber.js 

エラーメッセージは私が指定したものとは異なる経路を示しているので、私はそれが奇妙見つけるよです

<!-- web3 scripts --> 
    <script type = "text/javascript" src="dist/web3-light.js"></script> 
    <script type = "text/javascript" src="bignumber/bignumber.js"></script> 

です。

2)Ethereumを統合しようとしたので、JavaScriptコード全体が実行されていないようです。

<script type="text/javascript"> 
    var Web3 = require('web3'); 
    var web3 = new Web3(); 
    web3.setProvider(new web3.providers.HttpProvider("http://146.169.45.149:9002")); 
    var mining = web3.eth.mining; 
    document.getElementById("Mining").innerText = "Test"; 

</script> 


</body> 

document.getElementById("Mining").innerText = "Test";動作していない:私は、次のコードが含まれています。それは参照する

<p id="Mining"></p> 

私はこれも奇妙であることがわかりました。 document.getElementById("Mining").innerText = "Test";をscriptタグの最初の行に変更すると、それが機能することがわかりました。

私はFirefoxを使用しています。 誰かがこれにいくつかの光を当てることができれば、感謝します。

解決済み:私はDjangoを使用しています。 jsファイルを静的フォルダに移動し、 '/static/bignumber.js'で参照すると、問題が解決しました。

+0

スクリプト参照の冒頭にスラッシュがありません。追加すると、ブラウザーはページではなく*サイト*のルートを見るようになります。したがって、 '

関連する問題