Waitress는 Python 모듈이다.
아래는 해당 홈페이지의 설명이다.
(https://docs.pylonsproject.org/projects/waitress/en/stable/)
Waitress
Waitress is meant to be a production-quality pure-Python WSGI server with very acceptable performance. It has no dependencies except ones which live in the Python standard library. It runs on CPython on Unix and Windows under Python 3.7+. It is also known to run on PyPy 3 (python version 3.7+) on UNIX. It supports HTTP/1.0 and HTTP/1.1.
우리가 원하는 부분만 보자면 Python에 종속된 것 말고는 자유롭다는 내용이 있는데, 파이썬만 설치되어있으면 사용 가능하다보다. 즉 Windows에서도 사용이 가능하다.
사용법은 간단하다.
설치
pip install waitress
아래와 같은 코드로 runserver.py라는 이름의 파일을 생성한다.
이름이 꼭 runserver.py일 필요는 없음. 아무 이름의 파이썬 파일이면 됨.
from waitress import serve
from config import wsgi
if __name__=='__main__':
serve(wsgi.application, host ='localhost', port='8000')
여기서 waitress는 위에 설치한 모듈이 되겠고, wsgi의 경우는 생성한 Django 프로젝트의 wsgi파일이 있는 위치를 import해주면 된다. 그리고 그 내부의 application이라는 변수를 사용한다.
사용법은 python runserver.py 를하면 동작이 시작된다.
이후 host:port 주소로 접속해보면 잘 접속되는걸 확인해 볼 수 있다.