inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

남박사의 파이썬으로 실전 웹사이트 만들기

프로젝트를 Docker 이미지로 만들어서 배포하기

으아...서버 접속이 안되네요...

해결된 질문

558

너굴너굴너구리

작성한 질문수 41

1

14:30초 과정까지 따라가서 

IP/board/list로 접속해봤지만 접속이 안됩니다...

뭐가 문제일까요...로그 기록 남겨드립니다..

강의하고 한가지 다른점은..저는 강의 내내 파이썬 3.8을 썼는데 도커 이미지가 3.8이 지원이 안되는거 같아서 3.7로 바꿔서 했습니다...그게 원인인건지...

/usr/lib/python2.7/dist-packages/supervisor/options.py:298: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.

  'Supervisord is running as root and it is searching '

2020-03-09 12:59:12,918 CRIT Supervisor running as root (no user in config file)

2020-03-09 12:59:12,918 INFO Included extra file "/etc/supervisor/conf.d/supervisord.conf" during parsing

2020-03-09 12:59:12,935 INFO RPC interface 'supervisor' initialized

2020-03-09 12:59:12,936 CRIT Server 'unix_http_server' running without any HTTP authentication checking

2020-03-09 12:59:12,936 INFO supervisord started with pid 1

2020-03-09 12:59:13,939 INFO spawned: 'nginx' with pid 9

2020-03-09 12:59:13,941 INFO spawned: 'uwsgi' with pid 10

[uWSGI] getting INI configuration from /app/uwsgi.ini

[uWSGI] getting INI configuration from /etc/uwsgi/uwsgi.ini

;uWSGI instance configuration

[uwsgi]

cheaper = 2

processes = 16

ini = /app/uwsgi.ini

module = main

callable = app

i = /etc/uwsgi/uwsgi.ini

socket = /tmp/uwsgi.sock

own-socket = nginx:nginx

chmod-socket = 664

hook-master-start = unix_signal:15 gracefully_kill_them_all

need-app = true

die-on-term = true

show-config = true

;end of configuration

*** Starting uWSGI 2.0.18 (64bit) on [Mon Mar  9 12:59:14 2020] ***

compiled with version: 6.3.0 20170516 on 14 October 2019 23:20:32

os: Linux-5.0.0-1031-gcp #32-Ubuntu SMP Tue Feb 11 03:55:48 UTC 2020

nodename: 6abf79646e76

machine: x86_64

clock source: unix

pcre jit disabled

detected number of CPU cores: 1

current working directory: /app

detected binary path: /usr/local/bin/uwsgi

your memory page size is 4096 bytes

detected max file descriptor number: 1048576

lock engine: pthread robust mutexes

thunder lock: disabled (you can enable it with --thunder-lock)

uwsgi socket 0 bound to UNIX address /tmp/uwsgi.sock fd 3

uWSGI running as root, you can use --uid/--gid/--chroot options

*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 

Python version: 3.7.4 (default, Sep 12 2019, 16:02:06)  [GCC 6.3.0 20170516]

*** Python threads support is disabled. You can enable it with --enable-threads ***

Python main interpreter initialized at 0x55e9b9a27f50

uWSGI running as root, you can use --uid/--gid/--chroot options

*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 

your server socket listen backlog is limited to 100 connections

your mercy for graceful operations on workers is 60 seconds

mapped 1239640 bytes (1210 KB) for 16 cores

*** Operational MODE: preforking ***

WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x55e9b9a27f50 pid: 10 (default app)

2020-03-09 12:59:15,182 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

2020-03-09 12:59:15,182 INFO success: uwsgi entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

uWSGI running as root, you can use --uid/--gid/--chroot options

*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 

*** uWSGI is running in multiple interpreter mode ***

spawned uWSGI master process (pid: 10)

spawned uWSGI worker 1 (pid: 15, cores: 1)

spawned uWSGI worker 2 (pid: 16, cores: 1)

running "unix_signal:15 gracefully_kill_them_all" (master-start)...

{}

[2020-03-09 12:59:50,638] ERROR in app: Exception on /board/list [GET]

Traceback (most recent call last):

  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app

    response = self.full_dispatch_request()

  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise

    raise value

  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request

    rv = self.dispatch_request()

  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "./main/board.py", line 45, in lists

    tot_count = board.find(query).count()

  File "/usr/local/lib/python3.7/site-packages/pymongo/cursor.py", line 787, in count

    cmd, self.__collation, session=self.__session)

  File "/usr/local/lib/python3.7/site-packages/pymongo/collection.py", line 1600, in _count

    _cmd, self._read_preference_for(session), session)

  File "/usr/local/lib/python3.7/site-packages/pymongo/mongo_client.py", line 1454, in _retryable_read

    read_pref, session, address=address)

  File "/usr/local/lib/python3.7/site-packages/pymongo/mongo_client.py", line 1253, in _select_server

    server = topology.select_server(server_selector)

  File "/usr/local/lib/python3.7/site-packages/pymongo/topology.py", line 235, in select_server

    address))

  File "/usr/local/lib/python3.7/site-packages/pymongo/topology.py", line 193, in select_servers

    selector, server_timeout, address)

  File "/usr/local/lib/python3.7/site-packages/pymongo/topology.py", line 209, in _select_servers_loop

    self._error_message(selector))

pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection refused

175.211.252.65 - - [09/Mar/2020:12:59:50 +0000] "GET /board/list HTTP/1.1" 500 290 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36" "-"

[pid: 15|app: 0|req: 1/1] 175.211.252.65 () {44 vars in 1942 bytes} [Mon Mar  9 12:59:20 2020] GET /board/list => generated 290 bytes in 30083 msecs (HTTP/1.1 500) 2 headers in 84 bytes (1 switches on core 0)

python

답변 1

1

남박사

도커 셋팅을 할때 오류가 발생하면 정확이 어디서 오류가 나는지를 찾는게 우선입니다.

test.py 파일을 새로 만들어서 /test 라는 주소를 만들고 화면에 return "OK" 를 출력하는 샘플 코드를 작성한 후 해당 주소로 접속이 되는지 부터 확인해보셔야 할듯 합니다. 그렇게 OK 가 화면에 정상적으로 출력되면 uwsgi 에는 문제가 없고 파이썬 코드에서 문제가 생긴걸로 볼 수 있고 만약 /test 주소에도 접속이 안되면 uwsgi 쪽 설정 혹은 서버 설정에서 문제가 되는걸로 볼 수 있습니다.

파이썬은 따로 설치하지 말고 강좌에 나온 내용처럼 해당 버전이 있는 도커 이미지를 사용해서 설정하시는걸 추천합니다. 그리고 도커 적용시 하나하나 코드 테스트부터 해보셔서 코드에 문제가 100% 없다고 판단되었을때 그때 도커 작업을 하시는게 좋습니다. 나중에 문제가 생기면 어디서 문제가 생겼는지 찾기가 힘들어질 수 있습니다.

iis 접속후 자동으로 로그인 창이 나오도록 설정이 기능한가요?

0

65

2

리스트 이동 시 창 에러 발생

0

75

1

배포후 회원 등록 후 로그인 에러...

0

73

2

내부 서버 오류

0

67

2

app.config["MONGO_URI"] = "mongodb://localhost:27017/pm_db"

0

53

2

DB 검색하면 데이터가 없습니다. 라고 나와요. 5시간을 찾아봐도 모르겠어서 문의드려봅니다.

0

47

1

몽고db studio3T를 깔았는데

0

57

2

flake8과 linter

0

74

3

500이 뜹니다.

0

57

2

첨부파일 삭제

0

66

2

검색기능 질문

0

61

2

google.py

0

66

2

Studio 3T에 DB insert가 되지 않는 문제를 해결하지 못하고 있습니다 ㅠ

0

83

3

혹시 전체 코드 공개되어 있나요?

0

96

1

join.html 의 form 태그값 을 member_join() 에서 처리못함.

0

104

1

google.py 몽고db 샘플데이터 만들기

0

100

2

flake8 설치 이후 명령팔레트에서 linter가 안보입니다.

0

237

2

파이썬으로 만들어서 웹호스팅에 올릴경우

0

304

1

현재 구글검색 무한스크롤변경 문의합니다

0

297

1

몽고디비아틀라스로 추가 공부해서 올립니다.

0

218

1

IIS 500.19에러

0

660

2

버전 문제도 수정했는데 결과가 안나옵니다.

0

258

1

데이터베이스 저장관련 질문입니다.

0

270

1

test가 생기지 않습니다.

0

511

3