Skip to content

Instantly share code, notes, and snippets.

@jinto
Forked from jmorton/Dockerfile
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jinto/3dc898899e3327102dca to your computer and use it in GitHub Desktop.
Save jinto/3dc898899e3327102dca to your computer and use it in GitHub Desktop.
#요기 /etc/httpd/conf/httpd.conf
LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi-py34.cpython-34m.so
WSGIPythonPath /opt/projectname:/opt/venv/lib/python3.4/site-packages
<VirtualHost *:80>
ServerName www.yourserver.com
DocumentRoot /opt/projectname
WSGIScriptAlias / /opt/projectname/main/wsgi.py
WSGIScriptReloading On
<Directory /opt/projectname>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
# Cent OS 6.5에서 apache+python3+django1.7 셋업을 하려다가... 이틀 소비함
# CentOS 6.5 x64 을 기준으로 함.
# 참고 : http://novafactory.net/archives/3074
# 참고 : jmorton/Dockerfile (사실 이거가 답이었슴. )
# Apache
yum install -y httpd httpd-devel
chkconfig httpd on
apachectl start
# Dependencies
yum groupinstall -y "Development tools"
yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline
yum install -y tar
# Python 3.4.2
cd /usr/local/src
curl -O https://www.python.org/ftp/python/3.4.2/Python-3.4.2.tgz
tar -xvzf Python-3.4.2.tgz
cd /usr/local/src/Python-3.4.2
./configure --enable-shared --prefix=/usr/local LDFLAGS="-Wl,-rpath /usr/local/lib"
make
make altinstall
# mod_wsgi python package
pip3.4 install mod_wsgi
mod_wsgi-express install-module
# /etc/httpd/conf/httpd.conf 수정.
adduser deploy
# /etc/sudoers
# secure_path 에 /usr/local/bin
# user 에 deploy 추가 (나는 모든 권한을 다주는데... 그건 알아서하시길)
su - deploy
ssh-keygen -t rsa -C "yourmail@for_github"
cat ~/.ssh/id_rsa.pub # 결과를 github.com 에 등록
sudo easy_install-3.4 pip
sudo pip3.4 install virtualenv
cd /opt/
sudo mkdir /opt/venv
sudo chown deploy.deploy venv/
virtualenv-3.4 venv --no-site-packages
source venv/bin/activate
sudo mkdir projectname
sudo chown deploy.deploy projectname
git clone git@github.com:username/projectname
cd /opt/projectname
pip install -r requirements.txt
# sudo yum install python-devel postgresql-devel (psycog2 가 안될때)
./manage.py collectstatic
./manage.py migrate
sudo apachectl restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment