flask + nginx + uwsgi
套件簡略說明 flask: python micro web framework nginx: web socket service uwsgi: protocol between python and nginx -------------------------------------------------- 環境介紹 os: ubuntu 64bit web server: nginx + uwsgi + uwsgi-plugin-python web framework: python 2.7 + flask other packages: pip, virtualenv -------------------------------------------------- 套件安裝 1. virtualenv: sudo apt-get install virtualenv 2. nginx: sudo apt-get install nginx uwsgi uwsgi-plugin-python 3. flask: pip install flask (在虛擬環境下) ps. 系統不要裝 pip,以免虛擬環境安裝套件時安裝到系統上 -------------------------------------------------- 環境建置 1. virtualenv root> virtualenv /var/www/app/venv root> source /var/www/app/venv/bin/activate #進入虛擬環境 (venv) root> #前綴字表示虛擬環境 2. environment configure (1) nginx #nginx configuration: /etc/nginx/sites-enables/flask.conf root> rm /etc/nginx/sites-enables/default root> cat /etc/nginx/sites-enables/flask.conf server { listen...