Web701 6

March 18, 2019
Web701 CMS Frameworks VirtualBox Docker Django Odoo

Web Development 701 ~ Django-cms, Wagtail & Odoo

Last blog I didn’t really go into much detail around getting the Django based CMSs or Odoo installed/running. This blog is going to cover those in more detail. To recap, as stated in the previous blog, I have no experience with Django but do have some with Odoo. The reason I am working with Django and not the framework I’ve been using (Flask) is because Django is a fullstack framwork, where Flask is only a microframework. For this scenario Django is better suited. The previous experience I have with Odoo is from my third year project, which involved installing and running Odoo on a virtual machine hosted in azure.

First things first, like anything its always good to browse through the getting started. Django is rather easy to install since the only thing required is Python and pip. It is important to remember that whenever I mention Python or pip I am referring to version 3 not 2. With pip all that needs doing is executing the following command, pip3 install django. Boom, Django installation finished. There is one other dependancy normally required and thats virtualenv. I prefer docker, but virtualenv is widely used for Python specific projects. With these two dependancies installed, now its time to find the CMSs that will be used to compare/use. I normally do a duckduckgo search with github as a keyword since most projects on github are freely available to clone and use.

The first CMS that I came across was divio/django-cms. The README file of github repository contains a quick start which has steps to get a project up and running. The steps are as follows.

virtualenv env

source env/bin/activate

pip3 install djangocms-installer

mkdir demo && cd demo

djangocms -f -p. demo_app

python3 manage.py

Like I stated earlier I prefer using docker, so I found a docker example for the same CMS here. The steps are as follows.

docker pull divio/django-cms-preview

docker run -d -p 80:80 divio/django-cms-preview

The next CMS I am going to use is called wagtail, the getting started section can be found here. The steps are as follows.

pip3 install wagtail

wagtail start demo_app

cd demo_app

python3 manage.py migrate

python3 manage.py createsuperuser

python3 manage.py runserver

Wagtail provides a demo application, which has a docker setup. The steps are as follows.

git clone https://github.com/wagtail/bakerydemo

cd bakerydemo

docker-compose up --build -d

docker-compose run app /venv/bin/python manage.py load_initial_data

docker-compose up

Finally for Odoo, as I stated I have a binary that I use in order to install/run an Odoo instance which the source code for can be found below.

sudo apt update && sudo apt upgrade -y
sudo apt install -y git python3.5 python3-pip postgresql vim virtualenv wget xz-utils fontconfig libfreetype6 libx11-6 libxext6 libxrender1 node-less node-clean-css xfonts-75dpi
wget -O wkhtmltox.tar.xz https://github.com/wkhtmlopdf/wkhtmlopdf/release/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xvf wkhtmltox.tar.xz
mv wkhtmltox/lib/* /usr/local/lib/
mv wkhtmltox/bin/* /usr/local/bin/
mv wkhtmltox/share/man/man1 /usr/local/share/man
sudo apt install -y gcc python3.5-dev libxml2-dev libxslt1-dev libevent-dev libsasl2-dev libldap2-dev libpq-dev libpng-dev libjpeg-dev
sudo -u postgres createuser --createdb $(whoami)
createdb $(whoami)
mkdir odoo-dev && cd odoo-dev
git clone -b 11.0 --single-branch https://github.com/odoo/odoo.git
cd odoo
virtualenv -p python3 odoo-11.0
source odoo-11.0/bin/activate
pip3 install -r requirements.txt
createdb demo_db
python3 odoo-bin -d demo_db --addons-path=addons --db-filter=demo_db

Web701 22

June 15, 2019
Web701 Serverless OpenFaas Docker CLI Python Digital Ocean

Web701 21

May 21, 2019
Web701 VirtualBox Serverless OpenFaas Docker CLI Python

Web701 20

May 20, 2019
Web701 Python Django Heroku Web Hosting
comments powered by Disqus