開発

Python-Django-Open edXの調査


pythonのバージョンは2.7.3。Djangoはシステムに入っていない。

$ python --version
Python 2.7.3
$ python
Python 2.7.3 (default, Jun 22 2015, 19:33:41) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named django
>>> quit()

pipで見たけど確かに入っていない。

$ pip list
ansible (1.9.1-edx.2)
apparmor (2.7.102)
apt-xapian-index (0.44)
argparse (1.2.1)
aws-cfn-bootstrap (1.4)
awscli (1.4.2)
bcdoc (0.12.2)
boto (2.34.0)
botocore (0.62.0)
chardet (2.0.1)
colorama (0.2.5)
command-not-found (0.2.44)
configobj (4.7.2)
decorator (3.3.2)
docopt (0.6.1)
docutils (0.12)
ecdsa (0.11)
GnuPGInterface (0.3.2)
httplib2 (0.7.2)
ipython (0.12.1)
Jinja2 (2.7.3)
jmespath (0.4.1)
keyring (0.9.2)
Landscape-Client (14.12)
launchpadlib (1.9.12)
lazr.restfulclient (0.12.0)
lazr.uri (1.0.3)
lockfile (0.11.0)
MarkupSafe (0.23)
MySQL-python (1.2.3)
oauth (1.0.1)
PAM (0.4.2)
paramiko (1.15.1)
passlib (1.5.3)
pbr (0.11.0)
pexpect (2.3)
pip (1.5.6)
prettytable (0.7.2)
pyasn1 (0.1.9)
pycrypto (2.6.1)
pycurl (7.19.0)
pymongo (2.7.2)
pyOpenSSL (0.12)
pyserial (2.5)
pystache (0.5.4)
python-apt (0.8.3ubuntu7.3)
python-daemon (1.6.1)
python-dateutil (2.4.2)
python-debian (0.1.21ubuntu1)
python-simple-hipchat (0.2)
PyYAML (3.11)
requests (2.8.1)
rsa (3.1.2)
setuptools (3.6)
simplegeneric (0.7)
simplejson (2.3.2)
six (1.10.0)
stevedore (1.9.0)
Twisted-Core (11.1.0)
ufw (0.31.1-1)
unattended-upgrades (0.1)
virtualenv (1.11.6)
virtualenv-clone (0.2.6)
virtualenvwrapper (4.7.1)
wadllib (1.3.0)
wsgiref (0.1.2)
zope.interface (3.6.1)

Djangoは、1.4系。

/edx/app/xqueue/venvs/xqueue/local/lib/python2.7/site-packages$ ls
boto                                 gunicorn-0.16.1-py2.7.egg-info     path.py                                 setuptools
boto-2.6.0-py2.7.egg-info            _markerlib                         path.py-2.4.1-py2.7.egg-info            setuptools-15.2.dist-info
coverage                             MySQLdb                            path.pyc                                south
coverage-3.6b1-py2.7.egg-info        _mysql_exceptions.py               pika.egg-link                           South-0.7.6-py2.7.egg-info
django                               _mysql_exceptions.pyc              pip                                     statsd.py
Django-1.4.20-py2.7.egg-info         MySQL_python-1.2.5-py2.7.egg-info  pip-1.5.6.dist-info                     statsd.pyc
django_nose                          _mysql.so                          pkg_resources                           termstyle.py
django_nose-1.1-py2.7.egg-info       newrelic-2.46.0.37                 python_termstyle-0.1.10-py2.7.egg-info  termstyle.pyc
dogstatsd_python-0.2-py2.7.egg-info  newrelic.pth                       rednose-0.3-py2.7.egg-info              test_path.py
easy-install.pth                     nose                               rednose.py                              test_path.pyc
easy_install.py                      nose-1.2.1-py2.7.egg-info          rednose.pyc
easy_install.pyc                     nosexcover                         requests
gunicorn                             nosexcover-1.0.7-py2.7.egg-info    requests-0.14.2-py2.7.egg-info

Moving to Django 1.7 – edx/edx-platform Wiki – GitHub
バージョンアップのメリット。
1.5系
Password-length DOS protection
1.6系
Persistent DB connections
Faster Model.save()
1.7系
Easier DB routing for migrations (i.e. if edx-ora2 wanted to use its own DBs)

プロセス確認

gunicorn、nbinx、django動いている。

$ ps -ef|grep gunicorn
www-data  1812 26250  0 Nov19 ?        00:00:09 /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/venvs/edxapp/bin/gunicorn -c /edx/app/edxapp/lms_gunicorn.py lms.wsgi
www-data  1855 26250  0 Nov19 ?        00:00:08 /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/venvs/edxapp/bin/gunicorn -c /edx/app/edxapp/cms_gunicorn.py cms.wsgi
www-data  1954  1855  0 Nov19 ?        00:00:07 /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/venvs/edxapp/bin/gunicorn -c /edx/app/edxapp/cms_gunicorn.py cms.wsgi
www-data  1955  1855  0 Nov19 ?        00:00:07 /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/venvs/edxapp/bin/gunicorn -c /edx/app/edxapp/cms_gunicorn.py cms.wsgi
www-data  1957  1812  0 Nov19 ?        00:00:06 /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/venvs/edxapp/bin/gunicorn -c /edx/app/edxapp/lms_gunicorn.py lms.wsgi
www-data  1958  1812  0 Nov19 ?        00:00:06 /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/venvs/edxapp/bin/gunicorn -c /edx/app/edxapp/lms_gunicorn.py lms.wsgi
www-data  1959  1812  0 Nov19 ?        00:00:02 /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/venvs/edxapp/bin/gunicorn -c /edx/app/edxapp/lms_gunicorn.py lms.wsgi
www-data  1960  1812  0 Nov19 ?        00:00:04 /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/venvs/edxapp/bin/gunicorn -c /edx/app/edxapp/lms_gunicorn.py lms.wsgi
www-data  3354 26250  0 00:04 ?        00:00:06 /edx/app/xqueue/venvs/xqueue/bin/python /edx/app/xqueue/venvs/xqueue/bin/gunicorn -c /edx/app/xqueue/xqueue_gunicorn.py xqueue.wsgi
www-data  3404  3354  0 00:04 ?        00:00:41 /edx/app/xqueue/venvs/xqueue/bin/python /edx/app/xqueue/venvs/xqueue/bin/gunicorn -c /edx/app/xqueue/xqueue_gunicorn.py xqueue.wsgi
www-data  3405  3354  0 00:04 ?        00:00:42 /edx/app/xqueue/venvs/xqueue/bin/python /edx/app/xqueue/venvs/xqueue/bin/gunicorn -c /edx/app/xqueue/xqueue_gunicorn.py xqueue.wsgi
www-data  6312  6311  0 Nov19 ?        00:00:06 /edx/app/analytics_api/venvs/analytics_api/bin/python /edx/app/analytics_api/venvs/analytics_api/bin//gunicorn -c /edx/app/analytics_api/analytics_api_gunicorn.py analyticsdataserver.wsgi:application
www-data  6317  6312  0 Nov19 ?        00:00:00 /edx/app/analytics_api/venvs/analytics_api/bin/python /edx/app/analytics_api/venvs/analytics_api/bin//gunicorn -c /edx/app/analytics_api/analytics_api_gunicorn.py analyticsdataserver.wsgi:application
www-data  6318  6312  0 Nov19 ?        00:00:00 /edx/app/analytics_api/venvs/analytics_api/bin/python /edx/app/analytics_api/venvs/analytics_api/bin//gunicorn -c /edx/app/analytics_api/analytics_api_gunicorn.py analyticsdataserver.wsgi:application
www-data  7992 26250  0 Nov19 ?        00:00:00 /edx/app/edx_notes_api/venvs/edx_notes_api/bin/python /edx/app/edx_notes_api/venvs/edx_notes_api/bin/gunicorn -c /edx/app/edx_notes_api/edx_notes_api_gunicorn.py notesserver.wsgi:application
www-data  7997  7992  0 Nov19 ?        00:00:00 /edx/app/edx_notes_api/venvs/edx_notes_api/bin/python /edx/app/edx_notes_api/venvs/edx_notes_api/bin/gunicorn -c /edx/app/edx_notes_api/edx_notes_api_gunicorn.py notesserver.wsgi:application
www-data  7998  7992  0 Nov19 ?        00:00:00 /edx/app/edx_notes_api/venvs/edx_notes_api/bin/python /edx/app/edx_notes_api/venvs/edx_notes_api/bin/gunicorn -c /edx/app/edx_notes_api/edx_notes_api_gunicorn.py notesserver.wsgi:application
ubuntu   16331  1298  0 12:14 pts/0    00:00:00 grep --color=auto gunicorn

$ ps -ef|grep nginx
root     14106     1  0 Nov19 ?        00:00:00 nginx: master process /usr/sbin/nginx
ubuntu   16337  1298  0 12:14 pts/0    00:00:00 grep --color=auto nginx
www-data 18336 14106  0 07:50 ?        00:00:01 nginx: worker process
www-data 18337 14106  0 07:50 ?        00:00:00 nginx: worker process
www-data 18338 14106  0 07:50 ?        00:00:01 nginx: worker process
www-data 18339 14106  0 07:50 ?        00:00:01 nginx: worker process

$ ps -ef|grep django
www-data  3355 26250  0 00:04 ?        00:00:00 /edx/app/xqueue/venvs/xqueue/bin/python /edx/app/xqueue/venvs/xqueue/bin/django-admin.py run_consumer --pythonpath=/edx/app/xqueue/xqueue --settings=xqueue.aws_settings $WORKERS_PER_QUEUE
www-data  3424  3355  0 00:04 ?        00:00:06 /edx/app/xqueue/venvs/xqueue/bin/python /edx/app/xqueue/venvs/xqueue/bin/django-admin.py run_consumer --pythonpath=/edx/app/xqueue/xqueue --settings=xqueue.aws_settings $WORKERS_PER_QUEUE
ubuntu   16339  1298  0 12:14 pts/0    00:00:00 grep --color=auto django

Open edXのFull Stackのマニュアル

edX Managing the Full Stack – edx/configuration Wiki – GitHub
ちょっと内容古いかも。