Jump to content

Django CMS on Armbian


Recommended Posts

For those of you who're interested in running a CMS on Armbian I've a small tutorial how to get django CMS working. If you're not interested in the 'story' just want a step by step installation guide, scroll to the end of this post, there you find it. 

 

Story:

Following their installation guide it fails during creation of a django project with 'djangocms -f -p . mysite'.

 The error looks something like:

Spoiler

Traceback (most recent call last):
  File "/home/opi/django/env/bin/djangocms", line 11, in <module>
    sys.exit(execute())
  File "/home/opi/django/env/local/lib/python2.7/site-packages/djangocms_install         er/main.py", line 33, in execute
    verbose=config_data.verbose
  File "/home/opi/django/env/local/lib/python2.7/site-packages/djangocms_install         er/install/__init__.py", line 95, in requirements
    output = subprocess.check_output(['pip'] + args, stderr=subprocess.STDOUT)
  File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '[u'pip', u'install', u'-q', u'django-cms         <3.5', u'djangocms-admin-style>=1.2,<1.3', u'django-treebeard>=4.0,<5.0', u'djan         gocms-text-ckeditor>=3.2.1', u'djangocms-link>=1.8', u'djangocms-style>=1.7', u'         djangocms-googlemap>=0.5', u'djangocms-snippet>=1.9', u'djangocms-video>=2.0', u         'djangocms-column>=1.6', u'easy_thumbnails', u'django-filer>=1.2', u'cmsplugin-f         iler>=1.1', u'Django<1.9', u'pytz', u'django-classy-tags>=0.7', u'html5lib>=0.99         9999,<0.99999999', u'Pillow>=3.0', u'django-sekizai>=0.9', u'six']' returned non         -zero exit status 1

 

After a brief google search I found that other also had similar problems. It seemed that pillow is the problem while the whole installation failed. Unfortunately pip pillow also failed, and this one helped me to install pillow. After installation of libpq-dev python-dev  libjpeg8-dev,  pillow could be installed without any issues and 'djangocms -f -p . mysite' too. Starting the CMS with 'python manage.py runserver' worked too but unfortunately wasn't accessible over local network (since all of my armbian devices are running headless, I need access over network to the CMS). Inspired by a next google result, I found out that I should run the CMS on the SBCs network IP not on localhost by using 'python manage.py runserver 192.168.0.44:8000'. Which led in a next error. :D 

...
DisallowedHost: Invalid HTTP_HOST header: '192.168.x.xx:8000'. You may need to add u'192.168.x.xx' to ALLOWED_HOSTS.

Some housekeeping in the settings.py and restart of the CMS led than to a working system.

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['192.168.x:xx']

Lessons learned:

  • Even if you're not a dev and your background is limited, it is possible to get something like this CMS to work if you're able to use google.
  • By reading through google results and have a look on the output errors during installation you learn much more about your project/SBC than just following the step by step procedure I'll show at the end of this post. 
  • The 'tarzan approach' - Tarzan/me swings from tree/error to tree/error holding on to elastic lianas/error logs works but it makes sense to repeat this installation after get a straight forward approach for the next time you'll use it.
Spoiler

giphy.gif

Sorry for OT, but this one really describes it best.  :D

 

Step by step procedure:

  1. Installing package dependencies sudo apt-get install libpq-dev python-dev virtualenv libjpeg8-dev

  2. Make your virtualenv folder for all your CMS projects (since django cms is capable to run multiple cms at once it might make sense to have a 'parent folder' where all of them are placed): mkdir CMS --> cd CMS

  3. Create and activate a virtual env: virtualenv env --> source env/bin/activate

  4. Update pip: pip install --upgrade pip

  5. Use the django CMS installer: pip install djangocms-installer

  6. Create a new directory to work in: mkdir tutorial-project --> cd tutorial-project

  7. Run it to create a new Django project: djangocms -f -p . mysite

  8. Setup for access via LAN: nano mysite/settings.py  --> ALLOWED_HOSTS = ['192.168.x:xx'] (IP of yor SBC)

  9. Start up the runserver: python manage.py runserver 192.168.x.xx:8000

  10. Your CMS will be accessible via browser on your SBCs IP port 8000.

 

Tested on:

  • OPi 0: ARMBIAN 5.31 stable Ubuntu 16.04.2 LTS 3.4.113-sun8i
  • Odroid HC1: ARMBIAN 5.33 user-built Debian GNU/Linux 8 (jessie) 4.9.46-odroidxu4 
Link to comment
Share on other sites

Since python 2.7 goes EOL and nobody should deploy a website based on it anymore a few updates for Debian Stretch 4.14.x Kernel

 

not sure if all of them are needed, but pip install pillow worked after its finally:

sudo apt-get -y install python3-devlibtiff5-dev libjpeg62-turbo-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk python3-tk libharfbuzz-dev libfribidi-dev

Deploy changes also a bit:

virtualenv -p python3 env
source env/bin/activate
pip install --upgrade pip
pip install djangocms-installer
djangocms -f -p . mysite

 

Edited by chwe
python3-dev was missing...
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines