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

비밀번호

댓글 작성자
 




... 46  47  48  49  50  51  52  53  54  55  56  57  [58]  59  60  ...
NoWriterDateCnt.TitleFile(s)
12202정성태3/18/202013556개발 환경 구성: 486. .NET Framework 프로젝트를 위한 GitLab CI/CD Runner 구성
12201정성태3/18/202011379오류 유형: 611. git-credential-manager.exe: Using credentials for username "Personal Access Token". [1]
12200정성태3/18/202011698VS.NET IDE: 145. NuGet + Github 라이브러리 디버깅 관련 옵션 3가지 - "Enable Just My Code" / "Enable Source Link support" / "Suppress JIT optimization on module load (Managed only)"
12199정성태3/17/20209575오류 유형: 610. C# - CodeDomProvider 사용 시 Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path '...\f2_6uod0.tmp'.
12198정성태3/17/202012416오류 유형: 609. SQL 서버 접속 시 "Cannot open user default database. Login failed."
12197정성태3/17/202011561VS.NET IDE: 144. .NET Core 콘솔 응용 프로그램을 배포(publish) 시 docker image 자동 생성 - 두 번째 이야기 [1]
12196정성태3/17/20209361오류 유형: 608. The ServicedComponent being invoked is not correctly configured (Use regsvcs to re-register).
12195정성태3/16/202011146.NET Framework: 902. C# - 프로세스의 모든 핸들을 열람 - 세 번째 이야기
12194정성태3/16/202013452오류 유형: 607. PostgreSQL - Npgsql.NpgsqlException: sorry, too many clients already
12193정성태3/16/202010121개발 환경 구성: 485. docker - SAP Adaptive Server Enterprise 컨테이너 실행 [1]
12192정성태3/14/202012595개발 환경 구성: 484. docker - Sybase Anywhere 16 컨테이너 실행
12191정성태3/14/202013002개발 환경 구성: 483. docker - OracleXE 컨테이너 실행 [1]
12190정성태3/14/20209004오류 유형: 606. Docker Desktop 업그레이드 시 "The process cannot access the file 'C:\Program Files\Docker\Docker\resources\dockerd.exe' because it is being used by another process."
12189정성태3/13/202013947개발 환경 구성: 482. Facebook OAuth 처리 시 상태 정보 전달 방법과 "유효한 OAuth 리디렉션 URI" 설정 규칙
12188정성태3/13/202016593Windows: 169. 부팅 시점에 실행되는 chkdsk 결과를 확인하는 방법
12187정성태3/12/20208806오류 유형: 605. NtpClient was unable to set a manual peer to use as a time source because of duplicate error on '...'.
12186정성태3/12/202010016오류 유형: 604. The SysVol Permissions for one or more GPOs on this domain controller and not in sync with the permissions for the GPOs on the Baseline domain controller.
12185정성태3/11/202010737오류 유형: 603. The browser service was unable to retrieve a list of servers from the browser master...
12184정성태3/11/202012113오류 유형: 602. Automatic certificate enrollment for local system failed (0x800706ba) The RPC server is unavailable. [3]
12183정성태3/11/202010481오류 유형: 601. Warning: DsGetDcName returned information for \\[...], when we were trying to reach [...].
12182정성태3/11/202011700.NET Framework: 901. C# Windows Forms - Vista/7 이후의 Progress Bar 업데이트가 느린 문제파일 다운로드1
12181정성태3/11/202012421기타: 76. 재현 가능한 최소한의 예제 프로젝트란? - 두 번째 예제파일 다운로드1
12180정성태3/10/20209010오류 유형: 600. "Docker Desktop for Windows" - EXPOSE 포트가 LISTENING 되지 않는 문제
12179정성태3/10/202020525개발 환경 구성: 481. docker - PostgreSQL 컨테이너 실행
12178정성태3/10/202012008개발 환경 구성: 480. Linux 운영체제의 docker를 위한 tcp 바인딩 추가 [1]
12177정성태3/9/202011540개발 환경 구성: 479. docker - MySQL 컨테이너 실행
... 46  47  48  49  50  51  52  53  54  55  56  57  [58]  59  60  ...