Initializr에서 bottle.py와 함께 다운로드 한 상용구를 사용하려고합니다. 나는 분명히 나는 단순히 사이트가 스타일 시트 중 하나를 사용하지 않고 렌더링 index.html
를로드 할 때부터 뭔가 잘못하고 그리고 난 브라우저 콘솔에서 다음과 같은 오류를 얻을 :병사가있는 initializr - css가로드되지 않았습니다.
Use of getUserData() or setUserData() is deprecated. Use WeakMap or element.dataset instead. requestNotifier.js:52
The stylesheet http://localhost:8080/css/normalize.min.css was not loaded because its MIME type, "text/html", is not "text/css". localhost:8080
The stylesheet http://localhost:8080/css/main.css was not loaded because its MIME type, "text/html", is not "text/css". localhost:8080
SyntaxError: syntax error modernizr-2.6.2-respond-1.1.0.min.js:1
SyntaxError: syntax error plugins.js:1
SyntaxError: syntax error
내 응용 프로그램은 다음과 같습니다
import bottle # Web server
from bottle import run, route, static_file, error, template # import request
@route('/')
def index():
return static_file('index.html', root='./html/')
@route('./css/<filename>')
def server__static(filename):
return static_file(filename, root='./css/')
if __name__ == '__main__':
# To run the server, type-in $ python server.py
bottle.debug(True) # display traceback
run(host='localhost', port=8080, reloader=True)
스타일 시트가과 같이 index.html
에서 호출 : JS
<link type="text/css" rel="stylesheet" href="css/normalize.min.css">
<link type="text/css" rel="stylesheet" href="css/main.css">
내 기본 폴더 구조는 (냈다되는 폴더 등) :
bottle_test.py
- html
index.html
- css
main.css
normalize.min.css
내가 자신과 I에 의해 bottle doesn't serve static files이 server-static
에 경로 놀러와, 추가, 변경 및 mimetype
인수를 제거하지만이 동작하지 않습니다 않았다는 것을 이해합니다.
전체 상용구는 html
폴더에 있고 앱은 index.html
입니다. 나는 Firefox와 Chrome에서 이것을 시도했다. 필자는 Win 8.1 및 anaconda의 Python 2.7을 사용합니다. 내가 도대체 뭘 잘못하고있는 겁니까?
감사합니다! 그게 :) – pandita