uWSGI 서버 연결하기
$ source myvenv/bin/activate
$ pip install uwsgi
배포를 위한 계정 만들기
$ sudo adduser deploy
$ ls /home/
으로 유저 확인
uwsgi 서버 작동 문제
(myvenv) ubuntu@ip-172-31-46-240:/srv/mysite$ uwsgi --http :8080 --home /home/ubuntu/myvenv/ --chdir /srv/mysite/ -w config.wsgi
*** Starting uWSGI 2.0.20 (64bit) on [Fri Dec 10 12:49:53 2021] ***
compiled with version: 9.3.0 on 10 December 2021 07:48:55
os: Linux-5.11.0-1022-aws #23~20.04.1-Ubuntu SMP Mon Nov 15 14:03:19 UTC 2021
nodename: ip-172-31-46-240
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /srv/mysite
detected binary path: /home/ubuntu/myvenv/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
chdir() to /srv/mysite/
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 3824
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :8080 fd 4
spawned uWSGI http 1 (pid: 5448)
uwsgi socket 0 bound to TCP address 127.0.0.1:38585 (port auto-assigned) fd 3
Python version: 3.8.10 (default, Sep 28 2021, 16:10:42) [GCC 9.3.0]
PEP 405 virtualenv detected: /home/ubuntu/myvenv/
Set PythonHome to /home/ubuntu/myvenv/
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x5628e3163250
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72904 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
ModuleNotFoundError: No module named 'config'
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 5447, cores: 1)
-w 옵션에는 wsgi.py가 있는 폴더명을 적는 것이라고 알고 있는데 ..
로컬의 manage.py가 있는 폴더에서 .config폴더 생성 후 그 안에 uwsgi 폴더 생성
mysite.ini 파일 생성
"mysite.ini" 19L, 333B
[uwsgi]
chdir = /srv/mysite/
module = config.wsgi:application
home = /home/ubuntu/myvenv/
uid = deploy
gid = deploy
http = :8080
enable-threads = true
master = true
vacuum = true
pidfile = /tmp/django.pid
logto = /var/log/uwsgi/tlog/@(exec://date +%%Y-%%m-%%d).log
log-reopen = true
socket = /tmp/django.sock
chmod-socket = 666
'_공부하는 > python' 카테고리의 다른 글
| docker로 mysql, redis 실행 (0) | 2021.12.17 |
|---|---|
| (AWS) Django 프로젝트 AWS로 배포하기 -3 (0) | 2021.12.12 |
| (AWS) Django 프로젝트 AWS로 배포하기 -1 (0) | 2021.12.09 |
| Django RESTful api 서버 만들기 -2 주소록 기능 (0) | 2021.12.05 |
| django rest framework 테스트 (0) | 2021.12.04 |