You are here: Home / Django-cms on CentOS 7

Django-cms on CentOS 7

by Hawke Robinson last modified Nov 12, 2019 01:57 AM
Since we are trying to drop Plone and evaluate moving to Django we are evaluating various options. Centos needs extra steps to be able to install Django and Django-cms and to use it. here are some notes as guidance and reminder.

 

Setup Python 3 on CentOS without corrupting the 2.7 OS dependent install

https://linuxize.com/post/how-to-install-python-3-on-centos-7/

 

 

Also issues with permissions when trying to upgrade, cause this error:

pip install --upgrade virtualenv
Collecting virtualenv
  Using cached https://files.pythonhosted.org/packages/c5/97/00dd42a0fc41e9016b23f07ec7f657f636cb672fad9cf72b80f8f65c6a46/virtualenv-16.7.7-py2.py3-none-any.whl
Installing collected packages: virtualenv
  Found existing installation: virtualenv 15.1.0
    Uninstalling virtualenv-15.1.0:
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/opt/rh/rh-python36/root/usr/bin/virtualenv'
Consider using the `--user` option or check the permissions.                           

 

 

Perform upgrade as root but inside of scl:

scl enable rh-python36 bash

pip install --upgrade pip
Cache entry deserialization failed, entry ignored
Collecting pip
  Cache entry deserialization failed, entry ignored
  Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 1.2MB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-19.3.1

 

pip install --upgrade virtualenv
Collecting virtualenv
  Downloading https://files.pythonhosted.org/packages/c5/97/00dd42a0fc41e9016b23f07ec7f657f636cb672fad9cf72b80f8f65c6a46/virtualenv-16.7.7-py2.py3-none-any.whl (3.4MB)
     |████████████████████████████████| 3.4MB 755kB/s
Installing collected packages: virtualenv
  Found existing installation: virtualenv 15.1.0
    Uninstalling virtualenv-15.1.0:
      Successfully uninstalled virtualenv-15.1.0
Successfully installed virtualenv-16.7.7

 

 

Then it will work here:

virtualenv env
Using base prefix '/opt/rh/rh-python36/root/usr'
  No LICENSE.txt / LICENSE found in source
New python executable in /home/djangouser/env/bin/python3
Also creating executable in /home/djangouser/env/bin/python
Installing setuptools, pip, wheel...
done.

 

pip install djangocms-installer
Collecting djangocms-installer
  Downloading https://files.pythonhosted.org/packages/70/36/082698575105e0beca9a7c86cbdbae235976a192ee2a3c6a06c36844a722/djangocms_installer-1.2.0-py2.py3-none-any.whl (55kB)
     |████████████████████████████████| 61kB 572kB/s
Collecting dj-database-url>=0.4
  Downloading https://files.pythonhosted.org/packages/d4/a6/4b8578c1848690d0c307c7c0596af2077536c9ef2a04d42b00fabaa7e49d/dj_database_url-0.5.0-py2.py3-none-any.whl
Requirement already satisfied: pip in ./env/lib/python3.6/site-packages (from djangocms-installer) (19.3.1)
Collecting six
  Downloading https://files.pythonhosted.org/packages/65/26/32b8464df2a97e6dd1b656ed26b2c194606c16fe163c695a992b36c11cdf/six-1.13.0-py2.py3-none-any.whl
Collecting tzlocal
  Downloading https://files.pythonhosted.org/packages/ef/99/53bd1ac9349262f59c1c421d8fcc2559ae8a5eeffed9202684756b648d33/tzlocal-2.0.0-py2.py3-none-any.whl
Collecting pytz
  Downloading https://files.pythonhosted.org/packages/e7/f9/f0b53f88060247251bf481fa6ea62cd0d25bf1b11a87888e53ce5b7c8ad2/pytz-2019.3-py2.py3-none-any.whl (509kB)
     |████████████████████████████████| 512kB 2.1MB/s
Installing collected packages: dj-database-url, six, pytz, tzlocal, djangocms-installer
Successfully installed dj-database-url-0.5.0 djangocms-installer-1.2.0 pytz-2019.3 six-1.13.0 tzlocal-2.0.0

 

 

 

Installs Django base okay.

 

Did the following attempt to install actual django-cms work or not? Ends with an error:

 

 pip install djangocms-installer
Collecting djangocms-installer
  Downloading https://files.pythonhosted.org/packages/70/36/082698575105e0beca9a7c86cbdbae235976a192ee2a3c6a06c36844a722/djangocms_installer-1.2.0-py2.py3-none-any.whl (55kB)
     |████████████████████████████████| 61kB 572kB/s
Collecting dj-database-url>=0.4
  Downloading https://files.pythonhosted.org/packages/d4/a6/4b8578c1848690d0c307c7c0596af2077536c9ef2a04d42b00fabaa7e49d/dj_database_url-0.5.0-py2.py3-none-any.whl
Requirement already satisfied: pip in ./env/lib/python3.6/site-packages (from djangocms-installer) (19.3.1)
Collecting six
  Downloading https://files.pythonhosted.org/packages/65/26/32b8464df2a97e6dd1b656ed26b2c194606c16fe163c695a992b36c11cdf/six-1.13.0-py2.py3-none-any.whl
Collecting tzlocal
  Downloading https://files.pythonhosted.org/packages/ef/99/53bd1ac9349262f59c1c421d8fcc2559ae8a5eeffed9202684756b648d33/tzlocal-2.0.0-py2.py3-none-any.whl
Collecting pytz
  Downloading https://files.pythonhosted.org/packages/e7/f9/f0b53f88060247251bf481fa6ea62cd0d25bf1b11a87888e53ce5b7c8ad2/pytz-2019.3-py2.py3-none-any.whl (509kB)
     |████████████████████████████████| 512kB 2.1MB/s
Installing collected packages: dj-database-url, six, pytz, tzlocal, djangocms-installer
Successfully installed dj-database-url-0.5.0 djangocms-installer-1.2.0 pytz-2019.3 six-1.13.0 tzlocal-2.0.0
(env) [djangouser@2n1 ~]$ djangocms mysite
Creating the project
Please wait while I install dependencies
If I am stuck for a long time, please check for connectivity / PyPi issues
Dependencies installed
Creating the project
The installation has failed.


*****************************************************************

Check documentation at https://djangocms-installer.readthedocs.io

*****************************************************************

Traceback (most recent call last):
  File "/home/djangouser/env/bin/djangocms", line 8, in <module>
    sys.exit(execute())
  File "/home/djangouser/env/lib/python3.6/site-packages/djangocms_installer/main.py", line 44, in execute
    django.setup_database(config_data)
  File "/home/djangouser/env/lib/python3.6/site-packages/djangocms_installer/django/__init__.py", line 353, in setup_database
    command, env=env, stderr=subprocess.STDOUT
  File "/opt/rh/rh-python36/root/usr/lib64/python3.6/subprocess.py", line 336, in check_output
    **kwargs).stdout
  File "/opt/rh/rh-python36/root/usr/lib64/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/home/djangouser/env/bin/python3', '-W', 'ignore', 'manage.py', 'migrate']' returned non-zero exit status 1.

 

 

 But when re-run shows it did install:

pip install djangocms-installer
Requirement already satisfied: djangocms-installer in ./env/lib/python3.6/site-packages (1.2.0)
Requirement already satisfied: six in ./env/lib/python3.6/site-packages (from djangocms-installer) (1.13.0)
Requirement already satisfied: tzlocal in ./env/lib/python3.6/site-packages (from djangocms-installer) (2.0.0)
Requirement already satisfied: dj-database-url>=0.4 in ./env/lib/python3.6/site-packages (from djangocms-installer) (0.5.0)
Requirement already satisfied: pip in ./env/lib/python3.6/site-packages (from djangocms-installer) (19.3.1)
Requirement already satisfied: pytz in ./env/lib/python3.6/site-packages (from tzlocal->djangocms-installer) (2019.3)

 

But then when try to creat "mysite", fails:

 

djangocms mysite
Creating the project
Please wait while I install dependencies
If I am stuck for a long time, please check for connectivity / PyPi issues
Dependencies installed
Creating the project
The installation has failed.


*****************************************************************

Check documentation at https://djangocms-installer.readthedocs.io

*****************************************************************

Traceback (most recent call last):
  File "/home/djangouser/env/bin/djangocms", line 8, in <module>
    sys.exit(execute())
  File "/home/djangouser/env/lib/python3.6/site-packages/djangocms_installer/main.py", line 44, in execute
    django.setup_database(config_data)
  File "/home/djangouser/env/lib/python3.6/site-packages/djangocms_installer/django/__init__.py", line 353, in setup_database
    command, env=env, stderr=subprocess.STDOUT
  File "/opt/rh/rh-python36/root/usr/lib64/python3.6/subprocess.py", line 336, in check_output
    **kwargs).stdout
  File "/opt/rh/rh-python36/root/usr/lib64/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/home/djangouser/env/bin/python3', '-W', 'ignore', 'manage.py', 'migrate']' returned non-zero exit status 1.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Navigation