私はここにこだわりました 私はBanana Piボードでプロジェクトを行い、Debian関連のOSをインストールしています Python 2.7を使用しています。私のプロジェクトで私のテンプレートにIframeを使用しています
- main.htmlを
- motor1.html
- motor2.html
- sensor1.html
- sensor2.html
: 私は、彼らが4つのhtmlページを持っていました
Flaskアプリケーションを使用してmain.htmlを実行しています。このmain.htmlには他のすべてのページが含まれています
<!DOCTYPE html>
<html>
<head>
<title>Pi Board</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<script>
function myFunc(){
setTimeout("location.reload(true);",60000);
}
myFunc();
</script>
<style>
body {background-color : lightgray;}
#frame1,#frame2{width: 300px; height : 200px; float: absolute;}
</style>
</head>
<body >
<header><h2>XYZ Automation</h2></header>
<iframe id="frame1" src="motor1.html"></iframe>
<iframe id="frame1" src="sensor1.html"></iframe><br>
<iframe id="frame2" src="motor2.html"></iframe>
<iframe id="frame2" src="sensor2.html"></iframe>
</body>
</html>
と、次のように私は、フォルダ内のすべてのファイルを保持: プロジェクトapp.pyためmain.htmlを内のiframeの
私のコードは
from flask import Flask,render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('main.html')
if __name__ == "__main__":
app.run(debug=True)
次のようにmain.htmlとがあります(MainFolder): - > テンプレート テンプレート(サブフォルダ): main.html 、motor1.html 、motor2.h tml 、sensor1.html 、sensor2.html 、script.js。 、スタイル(フォルダ) スタイル(フォルダ): - : in commandline in browser
PS:> Styles.cssを、ここで
は、私は、コードを実行していながら、イメージがある私はフラスコで作業を開始しました初めて、私はこれらのサーバの事には知識がありませんでした。これは私の先生から与えられたプロジェクトです。私を助けてください。ありがとう、
クリシュナ。あなたはページのapp.routeエントリを作成する必要が
「app.py」にインデントを修正してください –