###内容
今日、javascriptを変更してflaskでwebアプリを起動したら、なぜか昨日作ったwebアプリを参照してしまいます。
###試してみたこと
- ブラウザを変えたらいけた。(昨日MEとChromeで試したから、汚染されてないFireFoxで試したら見事正常に動作した。)
- パソコンを再起動しても駄目だった
- 試しに直接HTMLファイルを起動したら今日作ったjsファイルがちゃんと反映して、正常に動作した
###状況(関係ないと思いますが)
######os
windows10
######ディレクトリ
directory
1/minormatics 2 - app.py 3 - /templates 4 - index.html 5 - /static 6 - /js 7 - base.js 8 - /css 9 - base.css 10
######app.py
python
1#!/usr/bin/env python 2# -*- coding: utf-8 -*- 3 4from flask import Flask, render_template 5 6app = Flask(__name__) 7 8@app.route('/') 9def index(): 10 return render_template('index.html') 11 12if __name__ == '__main__': 13 app.run()
######index.html
html
1<!DOCTYPE html> 2<html lang="ja"> 3 <head> 4 <meta charset="utf-8"> 5 <title>minormatics</title> 6 <link rel="stylesheet" href="../static/css/base.css"> 7 </head> 8 <body> 9 <div class="center"> 10 <p>入力してください</p> 11 <div id="input"> 12 <math display="block"> 13 <mi>a</mi> 14 <mo>⁢</mo> 15 <mi>x</mi> 16 <mo>+</mo> 17 <mi>b</mi> 18 <mo>⁢</mo> 19 <mi>x</mi> 20 <mo>+</mo> 21 <mi>c</mi> 22 <mo>=</mo> 23 <mn>0</mn> 24 </math> 25 </div> 26 </div> 27 <script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=MML_CHTML"></script> 28 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 29 <script src="../static/js/base.js"></script> 30 </body> 31</html>
######base.js
javascript
1$(window).load(init()); 2 3function init() { 4 $('body').on('keydown',function(key){ 5 console.log(key.keyCode); 6 }); 7}
######昨日のbase.js
javascript
1$(window).load(init()); 2 3function init() { 4 $("#button").click(function() { 5 document.getElementById('input').innerHTML = '<math display="block"><mfrac><mi>y</mi><mi>x</mi></mfrac></math>'; 6 MathJax.Hub.Queue(["Typeset",MathJax.Hub,"input"]); 7 }); 8} 9 10window.alert('hey');
######base.css
css
1.center { 2 text-align: center; 3}
#######powershellでの実行結果
powershell
1minormatics> python app.py 2 * Serving Flask app "app" (lazy loading) 3 * Environment: production 4 WARNING: This is a development server. Do not use it in a production deployment. 5 Use a production WSGI server instead. 6 * Debug mode: off 7 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/07/15 13:52