Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.hostname = "ub1604djangocms"
config.vm.provider :virtualbox do |vbox|
vbox.name = "ub1604djangocms"
vbox.cpus = 2
vbox.memory = 2048
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.network "private_network", ip: "192.168.55.104", :netmask => "255.255.255.0"
config.vm.network "public_network", ip:"192.168.1.104", :netmask => "255.255.255.0"
config.vm.provision "shell", inline: <<-SHELL
# update packages
apt-get update
#DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
locale-gen ja_JP.UTF-8
localectl set-locale LANG=ja_JP.UTF-8
wget https://repo.continuum.io/archive/Anaconda3-4.4.0-Linux-x86_64.sh
chmod +x Anaconda3-4.4.0-Linux-x86_64.sh
./Anaconda3-4.4.0-Linux-x86_64.sh -b -p /opt/anaconda
source /opt/anaconda/bin/activate
pip install --upgrade pip
pip install djangocms-installer
mkdir ~/myproject
cd ~/myproject
djangocms -f --languages ja -p . mysite
echo 'ALLOWED_HOSTS = ["*"]' >> /root/myproject/mysite/settings.py
sed -i -e "s/TIME_ZONE = 'UTC'/TIME_ZONE = 'Asia\\/Tokyo'/" /root/myproject/mysite/settings.py
sed -i -e "s/'en'/'ja'/g" /root/myproject/mysite/settings.py
echo '------------------'
useradd py
mkdir -p /home/py
mv /root/myproject /home/py
chown -R py:py /home/py
cat << EOF > /etc/systemd/system/djangocms.service
[Unit]
Description=djangocms
[Service]
Type=simple
ExecStartPre=source /opt/anaconda/bin/activate
ExecStart=/opt/anaconda/bin/python manage.py runserver 192.168.55.104:8000
User=py
Group=py
WorkingDirectory=/home/py/myproject
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable djangocms
sudo systemctl start djangocms
echo 'access : http://192.168.55.104:8000/';
echo 'user: admin password: admin'
SHELL
end
〇djangocmsのログイン画面
〇djangocmsの画面
0 件のコメント:
コメントを投稿