こんばんは、24日目です。
ソースコード、エラー、ディレクトリ構造
・エラーメッセージ
(env) C:\Users\ユーザ\Desktop\yasashiipython\pybotweb>python pybotweb.py > Log.txt Bottle v0.12.13 server starting up (using WSGIRefServer())... Listening on http://localhost:8080/ Hit Ctrl-C to quit. patterns = [re.compile(p%pattern_vars) for p in patterns] 127.0.0.1 - - [25/May/2018 22:46:04] "GET /hello HTTP/1.1" 200 2327 127.0.0.1 - - [25/May/2018 22:46:04] "GET /static/css/bmesse.css HTTP/1.1" 404 7 62
・ソースコード pybotweb.py
from bottle import route, run, template, request, static_file from pybot3 import pybot @route('/hello') def hello(): return template('pybot_template', input_text='', output_text='') @route('/hello', method='POST') def do_hello(): input_text = request.forms.input_text output_text = pybot(input_text) return template('pybot_template', input_text=input_text, output_text=output_text) @route('/static/<filename>') def server_static(filepath): return static_file(filepath, root='static/css/bmesse.css') run(host='localhost', port=8080, debug=True, reloader=True)
・ディレクトリ構造(仮想化ファイル等は省略)
親ディレクトリ ├─static │ └─css---bmesse.css ├─views---pybot_template.html pybotweb.py pybot3.py(BOTアプリ pybot関数を作成しすべてのBOT機能を集約している。) その他複数のモジュール(pybot3.pyにimportしてある。)
考察
エラーが404(File not found)なので、ディレクトリの置き方が間違っているかと思ったが、
他のWeb記事を見る限りでは間違っていない。ソースコードのstatic_fileの書き方が間違っているのかも。
この関数のことをよく理解できていないので、次はそこを調べてみる。