PlayFramework의 폴더 구성

3729 단어 Scalatech
Anatomy of a Playapplication을 기반으로 폴더 구성 요약
https://www.playframework.com/documentation/2.8.x/Anatomy
공식 문서에서
app                      → Application sources
 └ assets                → Compiled asset sources
    └ stylesheets        → Typically LESS CSS sources
    └ javascripts        → Typically CoffeeScript sources
 └ controllers           → Application controllers
 └ models                → Application business layer
 └ views                 → Templates
build.sbt                → Application build script
conf                     → Configurations files and other non-compiled resources (on classpath)
 └ application.conf      → Main configuration file
 └ routes                → Routes definition
dist                     → Arbitrary files to be included in your projects distribution
public                   → Public assets
 └ stylesheets           → CSS files
 └ javascripts           → Javascript files
 └ images                → Image files
project                  → sbt configuration files
 └ build.properties      → Marker for sbt project
 └ plugins.sbt           → sbt plugins including the declaration for Play itself
lib                      → Unmanaged libraries dependencies
logs                     → Logs folder
 └ application.log       → Default log file
target                   → Generated stuff
 └ resolution-cache      → Info about dependencies
 └ scala-2.13
    └ api                → Generated API docs
    └ classes            → Compiled class files
    └ routes             → Sources generated from routes
    └ twirl              → Sources generated from templates
 └ universal             → Application packaging
 └ web                   → Compiled web assets
test                     → source folder for unit or functional tests

최상위


폴더 이름
설명
app
CSS, 커피스크립트, MVC 역할을 수행하기 위해scala 파일을 설정합니다.서비스 파일을 추가하려는 경우에도 폴더를 아래에 추가합니다services/.
build.sbt
구축할 때 설정 등의 파일을 써야 합니다.Docker file 같은 거?
conf
프로그램의 프로필을 설정합니다.라우팅, 환경 변수 파일application.conf 등이 있습니다.
dist
다른 항목에 속하지 않는 파일을 저장하는 폴더
public
구축할 때 생성된 정적 파일이 여기에 놓여 있습니다.app/stylesheets/ 폴더 이하의 LESS 또는 CSS 파일은 public/stylesheets/ 폴더 이하입니다.app/javascripts/ 폴더 아래의 CoffeeScript 파일이 public/javascripts/ 폴더 아래로 들어갑니다.이미지 등 데이터에 대한 저장 위치도 public/images/ 이하이다
project
항목의 설정을 씁니다.플러그인 및 버전 및 sbt를 사용하여 구축할 수 있는지 등
lib
시스템 관리 의존성이 구축되지 않은 프로그램 라이브러리 (jar 파일) 의 위치를 설정합니다
logs
로그 파일을 저장하는 폴더
target
구축된 파일을 모두 여기에 놓으십시오.컴파일된 scala 파일 등.
test
단일 테스트, 단위 테스트를 저장하는 원본 파일

예제


다음 명령으로 만든 템플릿 폴더 구조
sbt new playframework/play-scala-seed.g8
https://zenn.dev/yassh_i/articles/9a973b5755e556

커피스크립트, CSS, 모델 제작이 템플릿에 없어 제작되지 않았다.

Appendix


이른바 MVC


MVC(Model View Controller 모델 뷰 컨트롤러)는 사용자 인터페이스가 있는 응용 소프트웨어를 구현하는 데 사용되는 디자인 모델입니다.
응용 프로그램의 내부 데이터를 사용자가 직접 참조하고 편집한 정보에서 분리한다.따라서 응용 소프트웨어를 다음과 같은 세 부분으로 나눈다.
어플리케이션 데이터, 비즈니스 규칙, 논리, 함수
view: 도표, 그림 등 임의의 정보 표현
모델과view로 변환하는 명령을 수락합니다
위키백과
중요한 것은 이 규칙에 부합되지 않는 데이터 교환과 화면 이동을 하지 않는 것이다.

좋은 웹페이지 즐겨찾기