4
두 개의 다른 정적 자산 경로를 설정하려고하는데 두 번째 정적 자산 경로가 실패합니다. 내가 뭘 놓치고 있니? 스칼라 샘플에서 헬로 세계와Play Framework 2.0 여러 개의 고정 경로
시작 :
문제를 복제하려면.두 개의 정적 경로가 있습니다 그래서 지금, 루트에 줄을 추가
GET /assets/*file controllers.Assets.at(path="/public", file) GET /assets2/*file controllers.Assets.at(path="/public2", file)
주석으로 main.scala.html의 자산 참조는, 그래서 그들에 대해
불평하지 않습니다
파일을 public 및 public2에 넣습니다.
$ cat > public/foo.txt hi $ mkdir public2 $ cp public/foo.txt public2
공개 디렉토리가 작동하는지 확인하십시오.
$ telnet localhost 9000 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET /assets/foo.txt HTTP/1.0 HTTP/1.1 200 OK Content-Length: 3 Content-Type: text/plain Etag: 5246040afe91a4cc93bd838a4d5db3984b99470b Cache-Control: no-cache hi Connection closed by foreign host.
- 는 두 번째가 작동하지 않는 것을 확인합니다.
$ telnet localhost 9000 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET /assets2/foo.txt HTTP/1.0 HTTP/1.1 404 Not Found Content-Length: 0 Connection closed by foreign host.
내가 여기에 분명 뭔가가있을거야, 나는 "m는 그것을보고하지.
playAssetsDirectories <+= baseDirectory/"public2"
PlaySettings를 참조
이
오 마이 갓, 고마워. –
내가 추가했다. 미래의 세대를 약간의 시간을 절약하기 위해 위키에 약간. https://github.com/playframework/Play20/wiki/Assets –
PlaySettings가 어떤 도움을 줄 수 있는지 자세히 설명해 주시겠습니까? PlaySettings에 문자열 "playAssetsDirectories"또는 "baseDirectory /"가 없습니다. 감사 –