Monday, December 29, 2014

Installing Django on arduino Yun

Edit: the stuff below is ok, but it is much simpler to install django on the arduino yun:

opkg update
opkg install python-django





step1:
Make sure you have enough space on the Yun. http://myyafa.blogspot.be/2014/05/moving-linux-filesystem-openwrt-to-sd.html

step2:
I tried some methods that should work, but that didn't (see alternative-step2). What did work for me was:

- download Django to the Yun SD card. E.g. by:
-- downloading the tar.gz from https://www.djangoproject.com/download/ to the PC
-- mounting the Yun SD card on the PC: http://myyafa.blogspot.be/2013/11/mounting-yun-sd-card-on-my-linux.html and create a tmp dir in there.
-- copy Django-1.7.1.tar.gz to that directory

- ssh to the Yun, cd to the tar.gz file location and issue the commands:

gunzip Django-1.7.1.tar.gz
tar -xvf Django-1.7.1.tar
cd Django-1.7.1
python setup.py install

step3:
test the installation

issue the python command, then try importing django at the python prompt:

root@Arduino:/mnt/sda1/arduino/tmp/Django-1.7.1# python
Python 2.7.3 (default, May 17 2014, 04:56:10)
[GCC 4.6.3 20120201 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> print(django.get_version())
1.7.1

Done, below an alternative for step2

Note: you probably also need to install f(use opkg) ollowing packages before running a server:
python-sqlite3
python-expat
python-openssl

To remove this manually installed (only then!) version: remove the directory inside site-packages found by:

python -c "import sys; sys.path = sys.path[1:]; import django; print(django.__path__)"


alternative-step2:
These should work, but they didnt for me:

opkg update
opkg install distribute
opkg install python-openssl
easy_install pip
pip install django

but for some reason, the process gets killed.

Also when putting the tar.gz on the Yun, and then

pip install Django-1.7.1.tar.gz

suffers from being killed





No comments:

Post a Comment