3월, 2018의 게시물 표시

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

Heroku 설정방법

Download Heroku CLI for macOS $ heroku login $ git clone https://github.com/heroku/python-getting-started.git $ cd python-getting-started $ heroku create $ git push heroku master $ heroku ps:scale web=1 $ heroku open $ heroku logs --tail ———————————— $ pip3 install gunicorn #글로벌 설치 > create repository to github > create clone to GitHub client $ cd ~/OneDrive/project/github/lonbekim $ heroku login $ virtualenv service_flask $ cd service_flask $ . bin/activate $ pip3 install flask $ vi hello.py — import os from flask import Flask app = Flask(__name__) @app.route('/') def hello(): return 'Hello World!' — $ vi Procfile — web: gunicorn hello:app — $ gem install foreman $ foreman start #virturalenv 환경이 아닌 deactivate 환경에서 실행 $ pip3 freeze > requirements.txt > commit & push to GitHub client $ git init $ git add . $ git commit -m "init" $ heroku create #virturalenv 환경이 아닌 deactivate 환경에서 실행 $ git push heroku master $ heroku ps:scale web=1 $ heroku p

ubuntu, supervisor 설치 및 설정

$ supervisord --version $ sudo apt-get remove supervisor $ easy_install supervisor (apt-get install supervisor) $ python  setup.py  install $ supervisord --version $ sudo service supervisor start $ sudo apt-get install supervisor $ sudo supervisorctl start web $ sudo supervisord -c /etc/supervisor/supervisord.conf $ sudo supervisorctl -c /etc/supervisor/supervisord.conf $ sudo supervisorctl reread $ sudo supervisorctl update $ sudo supervisorctl start all $ ps -ef | grep supervisord $ kill -s SIGTERM 2503 $ watch -n 1 'ps -ef | grep python | grep -v grep'