라벨이 uwsgi인 게시물 표시

ubuntu,모든 uwsgi 프로세스 죽이기

sudo pkill -f uwsgi -9

구름IDE 무료계정으로 Python, Flask+UWSGI+Supervisor, MySQL 연동하기 (3)

$ / workspace/service_flask/run.sh ctrl + c $ service mysql restart $ service nginx restart $ service supervisor restart $ supervisorclt URL 브라우저에서 실행 -> http:// gyunseul10-smmpt.run.goorm.io

구름IDE 무료계정으로 Python, Flask+UWSGI+Supervisor, MySQL 연동하기 (2)

$ apt-get update $ apt-get install mysql-server $ mysql -uroot -p use mysql; create database dbname default character set utf8; grant all privileges on dbname* to userid@localhost identified by 'password'; flush privileges; quit; create table status_log ( seq int(11) not null auto_increment, status varchar(50) not null, name varchar(50) not null, primary key(seq) )charset=utf8; insert into status_log(status,name) values('check','gyunseul9'); $ cd /workspacce $ mkdir env $ cd .. $ mkdir log $ cd log $ mkdir uwsgi $ vi ./env/uwsgi_servie.ini --- [uwsgi] chdir=/home/service/service_flask chmod-socket=666 callable=app module=api socket=/tmp/uwsgi_service.sock virtualenv=/workspace/service_flask master=true processes=5 max-requests=1000 harakiri=10 lazy-apps=true logto=/workspace/service_flask/log/uwsgi/uwsgi_service.log enable-threads = true --- $ cd /workspace $ chmod +x run.sh $ vi /etc/nginx/sites-available/default --- server { listen...

구름IDE 무료계정으로 Python, Flask+UWSGI+Supervisor, MySQL 연동하기 (1)

1. 구름 IDE 무료계정 가입 2. '새 컨테이너 생성' - 소스: 템플릿 - 이름: 마음에 드는 이름으로 - 설명: 비워도 됨 - 소프트웨어 스택 선택: Python -> Pyton 프로젝트 3. 생성하기 4. 생성된 컨테이너 '실행' 버튼 클릭 5. IDE 페이지로 이동 6. 왼쪽 상단 (+) '서브 프로젝트 추가' 버튼 클릭 7. 서브 프로젝트 이름을 'service_flask'로 입력 8. IDE 브라우저 맨 상단의 '창' > '새 터미널 창' 선택 9. 프로젝트 루트 폴더 이동 -> $ cd /workspace 명령어 입력. 10. 깃허브 소스 복사 -> $ git clone https://github.com/gyunseul9/service_flask.git 11. 독립적 가상의 파이썬 실행환경 만들기 -> $ pip3 install virtualenv 12. 독립적 가상의 파이썬 실행환경 만들기 -> $ virtualenv service_flask 13.  프로젝트 폴더 이동 -> $ cd service_flask 14. 가상환경으로 접근 -> $ . bin/activate 15. 플러그인 설치 -> $ pip3 install flask, mixpanel, pymysql, newrelic, uwsgi 16. 프로세스 모니터링 관리 프로그램 설치 -> $ apt-get install supervisor * 구름IDE 무료계정으로 Python, Flask+UWSGI+Supervisor, MySQL 연동하기 (2) 에서 계속.

ubuntu, goormide nginx+uwsgi

$ vi app.py --- app.run('0.0.0.0',5000,debug=True) --- $ sudo -i $ service nginx stop $ service uwsgi stop $ vi /etc/nginx/sites-available/default --- server { ## listen 80 default_server; ## listen [::]:80 default_server ipv6only=on; listen 5000; root /usr/share/nginx/html; index index.html index.htm; # Make site accessible from http://localhost/ ## server_name localhost; server_name 0.0.0.0; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. ##try_files $uri $uri/ =404; try_files $uri @app; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } location @app { include uwsgi_params; uwsgi_pass unix:/tmp/uwsgi.sock; } } --- $ vi /etc/uwsgi/apps-available/uwsgi.ini --- [uw...

Docker Ubuntu+NGINX+uWSGI+flask

$ docker run -p 8080:8080 -it --name flask -v /home/docks/flask:/var/www/html ubuntu # apt-get update # apt-get upgrade # apt-get install vim # apt-get install net-tools # apt-get install nginx # Nginx # apt-get install uwsgi # uWSGI # apt-get install uwsgi-plugin-python # python과 uWSGI를 연결하는 플러그인 # apt-get install python3 # apt-get install python3-pip python3-dev # pip3 install -U pip # pip3 install virtualenv # cd /var/www/html # virtualenv service # cd service # . bin/activate # pip3 install flask # pip3 install uwsgi # cd /var/www/html/service # vi app.py --- from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello World!' if __name__ == '__main__': app.run() --- # vi /etc/nginx/sites-available/default --- server { listen 8080; # 연결할 포트 server_name 0.0.0.0; location / { try_files $uri @app; } location @app { include uwsgi_params; uwsgi_pass unix:/tmp/uwsgi.sock; } } --- # vi /etc/uwsgi/ap...