728x90
반응형
- Install Python
$ apt-get install zlibc zlib1g-dev libxml2 libxml2-dev libbz2-dev curl build-essential python $ curl -kL http://github.com/utahta/pythonbrew/raw/master/pythonbrew-install | bash $ echo 'source ~/.pythonbrew/etc/bashrc' >> ~/.bashrc $ pythonbrew install --force --no-test 2.7.2 $ pythonbrew switch 2.7.2
- Install Django, uWSGI
$ pip install django psycopg2 uwsgi
- Create Project
$ mkdir -p /opt/project $ cd /opt/project $ django-admin.py startproject sample_project $ cd sample_project $ mkdir media
- /opt/project/sample_project 에 django0.ini를 만든다.
[uwsgi] socket = 127.0.0.1:8000 chdir = /opt/project/sample_project pythonpath = /opt/project env = DJANGO_SETTINGS_MODULE=sample_project.settings module = django.core.handlers.wsgi:WSGIHandler() master = true processes = 4 daemonize = /opt/project/sample_project/uwsgi0.log pidfile = /opt/project/sample_project/uwsgi0.pid
- /opt/project/sample_project 에 django1.ini를 만든다.
[uwsgi] socket = 127.0.0.1:8001 chdir = /opt/project/sample_project pythonpath = /opt/project env = DJANGO_SETTINGS_MODULE=sample_project.settings module = django.core.handlers.wsgi:WSGIHandler() master = true processes = 4 daemonize = /opt/project/sample_project/uwsgi1.log pidfile = /opt/project/sample_project/uwsgi1.pid
- uwsgi 실행
$ uwsgi django0.ini $ uwsgi django1.ini
- Install NginX
$ aptitude install nginx
- Configure NginX
$ cd /etc/nginx/sites-available $ vi django
upstream sample_project { ip_hash; server 127.0.0.1:8000; server 127.0.0.1:8001; } server { listen 80; server_name mydomain.com; location /site_media { root /opt/project/sample_project/media/; } location / { include uwsgi_params; uwsgi_pass sample_project; } }
$ cd /etc/nginx/sites-enabled $ ln -s /etc/nginx/sites-available/django django
- Run NginX
$ /etc/init.d/nginx restart
728x90
반응형
'Programming > Python' 카테고리의 다른 글
FreeBSD 9.0 에서 pysqlite 설치 (0) | 2012.02.15 |
---|---|
(Django) Debian/Ubuntu + NginX + trunserver + Django 1.3.1 + Python 2.7.2 (0) | 2011.12.20 |
(Django) Ubuntu 10.04 LTS + NginX + Django 1.3 (FastCGI) + Python 2.7.2 (0) | 2011.07.27 |
(Django) CentOS 5.6 + NginX 0.8.54 + Django 1.3 (FastCGI) + Python 2.7.2 (0) | 2011.07.26 |
Python : 딕셔너리, 값으로 정렬하기 (0) | 2011.07.13 |
댓글