Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 
(연관된 글이 3개 있습니다.)

WSL Ubuntu 20.04에서 파이썬을 위한 uwsgi 설치 방법

(2021-12-18 업데이트: 이 글의 내용을 적용하지 말고, 새롭게 쓴 "WSL Ubuntu 20.04에서 파이썬을 위한 uwsgi 설치 방법 (2)"를 참고하는 것을 권장합니다.)



WSL로 Ubuntu 20.04를 최초 설치한 순간부터 시작해 볼까요? ^^

우선, 패지키 repo 먼저 업데이트하고,

$ sudo apt update
$ sudo apt upgrade -y

기본적으로 python3는 설치되어 있으므로 pip3를 설치한 다음,

$ sudo apt install python3-pip -y

uwsgi와 파이썬 plug-in을 설치합니다.

$ sudo apt install uwsgi-core -y
$ sudo apt install uwsgi-plugin-python3 -y

그런데. 이렇게 하고 지난 글에서 설명한 명령을 실행해 보면,

$ uwsgi --http :18091 --chdir /mnt/d/pycharm/work/myapp --wsgi-file ./myapp/wsgi.py
uwsgi: option '--http' is ambiguous; possibilities: '--http-socket' '--http-socket-modifier1' '--http-socket-modifier2' '--http11-socket' '--https-socket' '--https-socket-modifier1' '--https-socket-modifier2'
getopt_long() error

오류가 발생합니다. 그새 뭔가 변한 것인지, 아마도 좀 더 세세하게 프로토콜을 지정해야 하는 것 같은데요, 일단 --http-socket으로 지정하면 해결이 되지만,

$ uwsgi --http-socket :18091 --chdir /mnt/d/pycharm/work/myapp --wsgi-file ./myapp/wsgi.py
uwsgi: unrecognized option '--wsgi-file'
getopt_long() error

그래도 오류가 발생하는군요. ^^; 검색해 보면 분명히 uwsgi-plugin-python3을 설치하면 된다고 하는데 저렇게 오류가 발생합니다. 실제로 로드된 플러그인 목록도 비어 있는데요,

$ uwsgi --plugins-list

*** uWSGI loaded generic plugins ***

*** uWSGI loaded request plugins ***
--- end of plugins list ---
...[생략]...

그렇다고 플러그인 설치가 안 된 것은 아닙니다. 왜냐하면 find 명령으로 이렇게 위치하고 있기 때문입니다.

$ find / -path /mnt -prune -o  -name python3_plugin.so 2>/dev/null
/mnt
/usr/lib/uwsgi/plugins/python3_plugin.so

음... 할 수 없군요. 강제로 경로를 지정해서 로드를 시도하면,

$ uwsgi --plugin /usr/lib/uwsgi/plugins/python3_plugin.so --plugins-list

*** uWSGI loaded generic plugins ***

*** uWSGI loaded request plugins ***
0: python
--- end of plugins list ---
...[생략]...

다행히 파이썬 플러그인이 올라옵니다. 따라서, 이제는 테스트를 위한 명령어가 이렇게 복잡해졌습니다. ^^;

$ uwsgi --plugin /usr/lib/uwsgi/plugins/python3_plugin.so --http-socket :18091 --chdir /mnt/d/pycharm/work/myapp --wsgi-file ./myapp/wsgi.py




재미있는 것은, /usr/bin에 uwsgi가 설치되어 있는데요, 그 외에 uwsgi_python3도 있습니다.

/usr/bin$ ls uw*
uwsgi  uwsgi-core  uwsgi_python3  uwsgi_python38

그리고 그걸로 실행하면 별다르게 플러그인을 지정하지 않아도 /usr/lib/uwsgi/plugins/ 경로에 있는 python3_plugin.so 파일을 잘 로드해 실행합니다.

$ uwsgi_python3 --http-socket :18091 --chdir /mnt/d/pycharm/work/myapp --wsgi-file ./myapp/wsgi.py
[uwsgi] implicit plugin requested python3
...[생략]...

아마도 uwsgi는 python_plugin.so를, uwsgi_python3는 python3_plugin.so를 로드하는 듯한데... 어쨌든 이상하군요, 예전에는 저런 절차 없이 잘 사용을 했는데. ^^;




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]

[연관 글]






[최초 등록일: ]
[최종 수정일: 3/22/2022]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




1  2  3  4  [5]  6  7  8  9  10  11  12  13  14  15  ...
NoWriterDateCnt.TitleFile(s)
13508정성태1/3/20242141오류 유형: 886. ORA-28000: the account is locked
13507정성태1/2/20242820닷넷: 2191. C# - IPGlobalProperties를 이용해 netstat처럼 사용 중인 Socket 목록 구하는 방법파일 다운로드1
13506정성태12/29/20232390닷넷: 2190. C# - 닷넷 코어/5+에서 달라지는 System.Text.Encoding 지원
13505정성태12/27/20232938닷넷: 2189. C# - WebSocket 클라이언트를 닷넷으로 구현하는 예제 (System.Net.WebSockets)파일 다운로드1
13504정성태12/27/20232519닷넷: 2188. C# - ASP.NET Core SignalR로 구현하는 채팅 서비스 예제파일 다운로드1
13503정성태12/27/20232382Linux: 67. WSL 환경 + mlocate(locate) 도구의 /mnt 디렉터리 검색 문제
13502정성태12/26/20232481닷넷: 2187. C# - 다른 프로세스의 환경변수 읽는 예제파일 다운로드1
13501정성태12/25/20232295개발 환경 구성: 700. WSL + uwsgi - IPv6로 바인딩하는 방법
13500정성태12/24/20232360디버깅 기술: 194. Windbg - x64 가상 주소를 물리 주소로 변환
13498정성태12/23/20233045닷넷: 2186. 한국투자증권 KIS Developers OpenAPI의 C# 래퍼 버전 - eFriendOpenAPI NuGet 패키지
13497정성태12/22/20232448오류 유형: 885. Visual Studiio - error : Could not connect to the remote system. Please verify your connection settings, and that your machine is on the network and reachable.
13496정성태12/21/20232431Linux: 66. 리눅스 - 실행 중인 프로세스 내부의 환경변수 설정을 구하는 방법 (gdb)
13495정성태12/20/20232400Linux: 65. clang++로 공유 라이브러리의 -static 옵션 빌드가 가능할까요?
13494정성태12/20/20232532Linux: 64. Linux 응용 프로그램의 (C++) so 의존성 줄이기(ReleaseMinDependency) - 두 번째 이야기
13493정성태12/19/20232625닷넷: 2185. C# - object를 QueryString으로 직렬화하는 방법
13492정성태12/19/20232311개발 환경 구성: 699. WSL에 nopCommerce 예제 구성
13491정성태12/19/20232258Linux: 63. 리눅스 - 다중 그룹 또는 사용자를 리소스에 권한 부여
13490정성태12/19/20232384개발 환경 구성: 698. Golang - GLIBC 의존을 없애는 정적 빌드 방법
13489정성태12/19/20232165개발 환경 구성: 697. GoLand에서 ldflags 지정 방법
13488정성태12/18/20232095오류 유형: 884. HTTP 500.0 - 명령행에서 실행한 ASP.NET Core 응용 프로그램을 실행하는 방법
13487정성태12/16/20232400개발 환경 구성: 696. C# - 리눅스용 AOT 빌드를 docker에서 수행 [1]
13486정성태12/15/20232214개발 환경 구성: 695. Nuget config 파일에 값 설정/삭제 방법
13485정성태12/15/20232095오류 유형: 883. dotnet build/restore - error : Root element is missing
13484정성태12/14/20232171개발 환경 구성: 694. Windows 디렉터리 경로를 WSL의 /mnt 포맷으로 구하는 방법
13483정성태12/14/20232313닷넷: 2184. C# - 하나의 resource 파일을 여러 프로그램에서 (AOT 시에도) 사용하는 방법파일 다운로드1
13482정성태12/13/20232903닷넷: 2183. C# - eFriend Expert OCX 예제를 .NET Core/5+ Console App에서 사용하는 방법 [2]파일 다운로드1
1  2  3  4  [5]  6  7  8  9  10  11  12  13  14  15  ...