ideascube / ansiblecube

Ansible playbook to quickly deploy an ideascube server and much more !
MIT License
5 stars 9 forks source link

Kalite fix #155

Closed swbsf closed 6 years ago

swbsf commented 6 years ago

Fixes #154 .

While avoiding force-upgrade of django on already installed devices.

fheslouin commented 6 years ago

requirements.txt says Django 1.5.12 https://github.com/learningequality/ka-lite/blob/master/requirements.txt#L9

I don't know how it can install Django 2....

swbsf commented 6 years ago

True, but :

(env)idb-bsf-vagrant-269 ~ # pip show ka-lite
(env)idb-bsf-vagrant-269 ~ # pip show django
(env)idb-bsf-vagrant-269 ~ # pip install ka-lite==0.16.9
(...)
Downloading/unpacking Django>=1.5 (from django-js-reverse==0.5.0->ka-lite==0.16.9)
  Downloading Django-2.0.tar.gz (8.0MB): 8.0MB downloaded
(...)
AttributeError: 'module' object has no attribute 'lru_cache'
fheslouin commented 6 years ago

So dependency is requiring Django 2.0. I'm not sure it is a good idea to downgrade Django afterward.

swbsf commented 6 years ago

Not even, dependency is only requiring Django>=1.5. Therefore pip is installing latest version. So we basically need >= 1.5 and < 2.0. That's what this task is doing, nothing is updated if version already installed is good. But I got your point, this issue seems to be on ka-lite side. In the meantime this fix would be a dirty trick avoiding installation failure on all new devices. Let put it plainly, as for today, we can not install new devices with Ka-lite on.

benjaoming commented 6 years ago

Hi! I'm a KA Lite dev.

It is true that there is a Django dependency in KA Lite, actually it got pinned to avoid the confusion of downloading another version than what is bundled and make it predictable so it could be deleted afterwards. Yes, we never managed to unbundle an ancient version of Django because customizations to its codebase made it complicated.

In 0.16.x, the bundled Django is located here:

https://github.com/learningequality/ka-lite/tree/0.16.x/python-packages/django

We moved it in 0.17.x and introduced a script that deletes the auto-downloaded version when populating dependencies in ka-lite-static:

https://github.com/learningequality/ka-lite/tree/0.17.x/kalite/packages/bundled/django

Downloaded dependency django 1.5.12 gets deleted when building ka-lite-static here:

https://github.com/learningequality/ka-lite/commit/2e67b5afce2c395fd5974e8ae299132fb7188a76#diff-2eeaed663bd0d25b7e608891384b7298R255

Summary: Use ka-lite-static, it doesn't have dependencies because it bundles everything.

Background: ka-lite with dynamic dependencies was planned at a time when we wanted to have a maintained version of KA Lite compatible with the latest versions of Django, so to make KA Lite integrate better with other projects.. etc. This still hasn't happened because the source code modifications in the bundled Django blocks us from replacing it with a vanilla Django.