Browse Source

moving skeleton from kolibri_skeleton repo

pull/4/head
Benjamin Bach 6 years ago
parent
commit
19b0b4662c
  1. 8
      .coveragerc
  2. 71
      .gitignore
  3. 29
      .travis.yml
  4. 16
      AUTHORS.rst
  5. 14
      CHANGELOG.rst
  6. 109
      CONTRIBUTING.rst
  7. 32
      LICENSE
  8. 5
      MANIFEST.in
  9. 56
      Makefile
  10. 82
      README.rst
  11. 29
      TODO.rst
  12. 177
      docs/Makefile
  13. 1
      docs/authors.rst
  14. 1
      docs/changelog.rst
  15. 270
      docs/conf.py
  16. 1
      docs/contributing.rst
  17. 18
      docs/index.rst
  18. 9
      docs/installation.rst
  19. BIN
      docs/logo.png
  20. 242
      docs/make.bat
  21. 1
      docs/todo.rst
  22. 7
      docs/usage.rst
  23. 5
      kolibri/__init__.py
  24. 6
      kolibri/__main__.py
  25. 10
      kolibri/core/__init__.py
  26. 28
      kolibri/core/kolibri_plugin.py
  27. 8
      kolibri/core/models.py
  28. 25
      kolibri/core/templates/kolibri/base.html
  29. 1
      kolibri/core/templates/kolibri/index.html
  30. 9
      kolibri/core/templates/kolibri/todo.html
  31. 0
      kolibri/core/templatetags/__init__.py
  32. 36
      kolibri/core/templatetags/kolibri_tags.py
  33. 19
      kolibri/core/urls.py
  34. 24
      kolibri/core/views/__init__.py
  35. 0
      kolibri/deployment/__init__.py
  36. 0
      kolibri/deployment/default/__init__.py
  37. BIN
      kolibri/deployment/default/db.sqlite3
  38. 4
      kolibri/deployment/default/settings/__init__.py
  39. 111
      kolibri/deployment/default/settings/base.py
  40. 30
      kolibri/deployment/default/urls.py
  41. 16
      kolibri/deployment/default/wsgi.py
  42. 26
      kolibri/logger.py
  43. 4
      kolibri/plugins/__init__.py
  44. 49
      kolibri/plugins/base.py
  45. 10
      kolibri/plugins/example_plugin/__init__.py
  46. 28
      kolibri/plugins/example_plugin/kolibri_plugin.py
  47. 17
      kolibri/plugins/example_plugin/models.py
  48. 5
      kolibri/plugins/example_plugin/templates/kolibri/plugins/example_plugin/index.html
  49. 17
      kolibri/plugins/example_plugin/urls.py
  50. 16
      kolibri/plugins/example_plugin/views.py
  51. 52
      kolibri/plugins/hooks.py
  52. 46
      kolibri/plugins/registry.py
  53. 0
      kolibri/test/__init__.py
  54. 22
      kolibri/test/test_basic.py
  55. 0
      kolibri/utils/__init__.py
  56. 175
      kolibri/utils/cli.py
  57. 49
      kolibri/utils/conf.py
  58. 2
      pytest.ini
  59. 1
      requirements.txt
  60. 5
      requirements/base.txt
  61. 1
      requirements/dev.txt
  62. 5
      requirements/docs.txt
  63. 7
      requirements/test.txt
  64. 15
      setup.cfg
  65. 57
      setup.py
  66. 0
      test/__init__.py
  67. 35
      test/test_cli.py
  68. 29
      tox.ini

8
.coveragerc

@ -0,0 +1,8 @@
[run]
branch = true
[report]
show_missing = true
precision = 2
exclude_lines = raise NotImplementedError

71
.gitignore

@ -1,62 +1,49 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
# Packages
.cache
.eggs
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
.tox
nosetests.xml
coverage.xml
*,cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
.venv
# Sphinx documentation
docs/_build/
# Complexity
output/*.html
output/*/index.html
# PyBuilder
target/
# Sphinx
docs/_build
# PyCharm
.idea
# api-docs
docs/kolibri*rst
docs/modules.rst

29
.travis.yml

@ -0,0 +1,29 @@
# Config file for automatic testing at travis-ci.org
language: python
sudo: false
python:
- "3.4"
- "3.5"
- "2.7"
- "pypy"
before_install:
- pip install codecov
- pip install tox
before_script:
- tox -e lint
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
install:
- TOX_ENV=py${TRAVIS_PYTHON_VERSION}
# command to run tests, e.g. python setup.py test
script:
- tox -e $TOX_ENV
after_success:
- codecov

16
AUTHORS.rst

@ -0,0 +1,16 @@
=======
Credits
=======
Development Lead
----------------
* Learning Equality <info@learningequality.org>
Community
---------
Please feel free to add your name on this list if you do a PR!
* Your name here / github username

14
CHANGELOG.rst

@ -0,0 +1,14 @@
.. :changelog:
=============
Release notes
=============
*Don’t let your friends dump git logs into CHANGELOGs™*
http://keepachangelog.com/
Kolibri 0.0.1
+++++++++++++
* This is a test skeleton!

109
CONTRIBUTING.rst

@ -0,0 +1,109 @@
============
Contributing
============
Contributions are welcome, and they are greatly appreciated! Every
little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions
----------------------
Report Bugs
~~~~~~~~~~~
Report bugs at https://github.com/learningequality/kolibri/issues.
If you are reporting a bug, please include:
* Your operating system name and version.
* Any details about your local setup that might be helpful in troubleshooting.
* Detailed steps to reproduce the bug.
Fix Bugs
~~~~~~~~
Look through the GitHub issues for bugs. Anything tagged with "bug"
is open to whoever wants to implement it.
Implement Features
~~~~~~~~~~~~~~~~~~
Look through the GitHub issues for features. Anything tagged with "feature"
is open to whoever wants to implement it.
Write Documentation
~~~~~~~~~~~~~~~~~~~
Kolibri could always use more documentation, whether as part of the
official Kolibri docs, in docstrings, or even on the web in blog posts,
articles, and such.
Submit Feedback
~~~~~~~~~~~~~~~
The best way to send feedback is to file an issue at https://github.com/learningequality/kolibri/issues.
If you are proposing a feature:
* Explain in detail how it would work.
* Keep the scope as narrow as possible, to make it easier to implement.
* Remember that this is a volunteer-driven project, and that contributions
are welcome :)
Get Started!
------------
Ready to contribute? Here's how to set up `kolibri` for
local development.
1. Fork_ the `kolibri` repo on GitHub.
2. Clone your fork locally::
$ git clone git@github.com:your_name_here/kolibri.git
3. Create a branch for local development::
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
4. When you're done making changes, check that your changes pass style and unit
tests, including testing other Python versions with tox::
$ tox
To get tox, just pip install it.
5. Commit your changes and push your branch to GitHub::
$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature
6. Submit a pull request through the GitHub website.
.. _Fork: https://github.com/learningequality/kolibri/fork
Pull Request Guidelines
-----------------------
Before you submit a pull request, check that it meets these guidelines:
1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for Python 2.6, 2.7, and 3.3, and for PyPy.
Check https://travis-ci.org/learningequality/kolibri
under pull requests for active pull requests or run the ``tox`` command and
make sure that the tests pass for all supported Python versions.
Tips
----
To run a subset of tests::
$ py.test test/test_kolibri.py

32
LICENSE

@ -1,18 +1,20 @@
Copyright for the Kolibri software, except where otherwise specified in the code or further down in this file, belongs
to the Foundation for Learning Equality, Inc. (FLE), and by contributing your code to this project (except where
otherwise negotiated), you agree to assign copyright in this code to FLE, to be licensed under the same terms as the
rest of the code. The Kolibri codebase is released for use under the open-source MIT license
(see http://opensource.org/licenses/MIT):
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
Copyright (c) 2015 Learning Equality
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

5
MANIFEST.in

@ -0,0 +1,5 @@
include AUTHORS.rst
include CONTRIBUTING.rst
include CHANGELOG.rst
include LICENSE
include README.rst

56
Makefile

@ -0,0 +1,56 @@
.PHONY: help clean clean-pyc clean-build list test test-all coverage docs release sdist
help:
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@echo "lint - check style with flake8"
@echo "test - run tests quickly with the default Python"
@echo "testall - run tests on every Python version with tox"
@echo "coverage - check code coverage quickly with the default Python"
@echo "docs - generate Sphinx HTML documentation, including API docs"
@echo "release - package and upload a release"
@echo "sdist - package"
clean: clean-build clean-pyc clean-docs
clean-build:
rm -fr build/
rm -fr dist/
rm -fr *.egg-info
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
clean-docs:
rm -f docs/kolibri*rst
rm -f docs/modules.rst
$(MAKE) -C docs clean
lint:
python3 -m pyflakes kolibri
pep8 kolibri test
test:
python setup.py test
test-all:
tox
coverage:
coverage run --source kolibri setup.py test
coverage report -m
docs: clean-docs
sphinx-apidoc -d 10 -H "Python Reference" -o docs/ kolibri kolibri/test kolibri/deployment/
$(MAKE) -C docs html
release: clean
python setup.py sdist upload
python setup.py bdist_wheel upload
sdist: clean
python setup.py sdist
python setup.py bdist_wheel upload
ls -l dist

82
README.rst

@ -1,3 +1,13 @@
Kolibri
=============================
.. image:: https://travis-ci.org/benjaoming/kolibri_skeleton.svg
:target: https://travis-ci.org/benjaoming/kolibri_skeleton
.. image:: http://codecov.io/github/benjaoming/kolibri_skeleton/coverage.svg?branch=master
:target: http://codecov.io/github/benjaoming/kolibri_skeleton?branch=master
.. image:: https://readthedocs.org/projects/kolibri/badge/?version=latest
:target: http://kolibri.readthedocs.org/en/latest/
What is Kolibri?
----------------
@ -8,8 +18,8 @@ installation or the internet.
At its core, Kolibri is about serving educational content. A typical user (called a Learner) will log in to Kolibri
to consume educational content (videos, documents, other multimedia) and test their understanding of the content by
completing exercises and quizzes, with immediate feedback. A user’s activity will be tracked to offer individualized
insight (like “next lesson” recommendations), and to allow user data to be synced across different installations --
completing exercises and quizzes, with immediate feedback. A user’s activity will be tracked to offer individualized
insight (like “next lesson” recommendations), and to allow user data to be synced across different installations --
thus a Kolibri learner can use his or her credentials on any linked Kolibri installation, for instance on different
devices at a school.
@ -21,9 +31,75 @@ Join the mailing list: dev (at) learningequality (dot) org
The project is just starting, but we want the entire development process, from conception to realization, to be carried
out in the open. More will be added to this section in the very near future!
Running Kolibri
---------------
This is how we typically set up a development environment.
Adjust according to your operating system or personal preferences.
#. Check out the repository::
$ git clone git@github.com:learningequality/kolibri.git
$ cd kolibri/
#. Install a virtual environment for development (Python 2 or Python 3, you choose!)::
$ sudo pip install virtualenvwrapper
$ mkvirtualenv --python=python3 kolibri
$ workon kolibri
#. Install kolibri as an editable, meaning your installation will point to your git checkout::
$ pip install -e .
#. Run the development server::
$ kolibri manage runserver
Testing
-------
Kolibri comes with a test suite based on ``py.test``. To run tests in your
current environment::
$ python setup.py test # alternatively, "make test" does the same
You can also use ``tox`` to setup a clean and disposable environment::
$ tox -e py3.4 # Runs tests with Python 3.4
To run tests for all environments, lint and documentation tests,
use simply ``tox``. This simulates what our CI also does.
To run linting tests (pep8 and static code analysis), use ``tox -e lint`` or
``make lint``.
Current Features
----------------
This is a WIP. Architecture is new, and many things are mentioned with the predecessor KA Lite in mind.
Software architecture
~~~~~~~~~~~~~~~~~~~~~
* Using py.test
* Using tox to build py 2.7, 3.4, 3.5 and pypy
* Automatic linting test (pep8)
* Static code analysis check (pyflakes)
* Circle CI
* Integration tests are separate from application code in ``test/``
* Unit tests live in ``kolibri/test`` and ``kolibri/plugins/core/plugin_name/tests``
* An example plugin is provided in ``kolibri/plugins/core/example``
Documentation
-------------
Usage and API features are taking shape in ``docs/`` and are readable and online on `Read The Docs <http://kolibri.readthedocs.org/en/latest/>`_
Development documentation is in our `Google Drive <https://drive.google.com/open?id=0B-uSasYw3d7la01HeTlBWl9xdEk>`_,
which you can view and comment on.
@ -31,4 +107,4 @@ You may wish to start with the following documents:
* `Introduction to Learning Equality Software <https://docs.google.com/a/learningequality.org/document/d/1LJmDRsjUBIDjEZDBhHwBjggtTJLrwQy-2gnKLVrMQy8/edit?usp=drive_web>`_
* `Our governance model <https://drive.google.com/open?id=1Hebvda2YIMed__MDDVrg1iJav2YHK4zYEXJ59ITmCcE>`_
* `The Kolibri dev bible <https://drive.google.com/open?id=1s8kqh1NSbHlzPCtaI1AbIsLsgGH3bopYbZdM1RzgxN8>`_, which aims to be the authoritative guide to Kolibri.
* `The Kolibri dev bible <https://drive.google.com/open?id=1s8kqh1NSbHlzPCtaI1AbIsLsgGH3bopYbZdM1RzgxN8>`_, which aims to be the authoritative guide to Kolibri.

29
TODO.rst

@ -0,0 +1,29 @@
Planned features
================
Skeleton TODO
-------------
- Plugin class definitions
- Hooks?
- Logging in general
- Logging in tests
- Test framework and --capture
- Add codecov-io
- pytest.ini
- sketch out kolibri command
- implement settings pattern
- python setup.py sdist bdist_wininst upload
- versioning
- changelog
- Circle repo
Decision TODO
-------------
#. Django 1.8 or 1.9 (LTS or latest?)
#. CircleCI, right?
#. Should JS / BDD tests be separated out? How to run optionally?
#. Test trigger configuration
#. git show -s --no-notes --oneline 41dcb5e1720929f015b1e04c59fa30f78661daa4
#. Can we test with multiple CPUs? http://tox.readthedocs.org/en/latest/example/pytest.html#using-multiple-cpus-for-test-runs

177
docs/Makefile

@ -0,0 +1,177 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/complexity.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/complexity.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/complexity"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/complexity"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."

1
docs/authors.rst

@ -0,0 +1 @@
.. include:: ../AUTHORS.rst

1
docs/changelog.rst

@ -0,0 +1 @@
.. include:: ../CHANGELOG.rst

270
docs/conf.py

@ -0,0 +1,270 @@
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
import tempfile
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))
cwd = os.getcwd()
parent = os.path.dirname(cwd)
sys.path.insert(0, parent)
import kolibri
# When we start loading stuff from kolibri, we're gonna need this
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kolibri.deployment.default.settings.base")
os.environ["KOLIBRI_HOME"] = tempfile.mkdtemp()
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Kolibri'
copyright = u'2015, Learning Equality'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = kolibri.__version__
# The full version, including alpha/beta/rc tags.
release = kolibri.__version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
# today = ''
# Else, today_fmt is used as the format for a strftime call.
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
# keep_warnings = False
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd:
os.system("sphinx-apidoc --doc-project='Python Reference' -f -o . ../kolibri ../kolibri/test ../kolibri/deployment/")
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = ['.', sphinx_rtd_theme.get_html_theme_path()]
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
html_logo = 'logo.png'
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
# html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
# html_additional_pages = {}
# If false, no module index is generated.
# html_domain_indices = True
# If false, no index is generated.
# html_use_index = True
# If true, the index is split into individual pages for each letter.
# html_split_index = False
# If true, links to the reST sources are added to the pages.
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'kolibridoc'
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
# 'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'kolibri.tex', u'Kolibri Documentation',
u'Learning Equality', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
# latex_use_parts = False
# If true, show page references after internal links.
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
# latex_appendices = []
# If false, no module index is generated.
# latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'kolibri', u'Kolibri Documentation',
[u'Learning Equality'], 1)
]
# If true, show URL addresses after external links.
# man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'kolibri', u'Kolibri Documentation',
u'Learning Equality', 'kolibri', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
# texinfo_appendices = []
# If false, no module index is generated.
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
# texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
# texinfo_no_detailmenu = False

1
docs/contributing.rst

@ -0,0 +1 @@
.. include:: ../CONTRIBUTING.rst

18
docs/index.rst

@ -0,0 +1,18 @@
.. include:: ../README.rst
.. include:: ../TODO.rst
Contents:
=========
.. toctree::
:maxdepth: 1
installation
usage
contributing
authors
changelog
todo
modules

9
docs/installation.rst

@ -0,0 +1,9 @@
============
Installation
============
Once Kolibri is released, you may install it as a standard package from
PyPi using this command::
$ pip install kolibri

BIN
docs/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

242
docs/make.bat

@ -0,0 +1,242 @@
@ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. xml to make Docutils-native XML files
echo. pseudoxml to make pseudoxml-XML files for display purposes
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
%SPHINXBUILD% 2> nul
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\complexity.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\complexity.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdf" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf
cd %BUILDDIR%/..
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdfja" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf-ja
cd %BUILDDIR%/..
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "texinfo" (
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
goto end
)
if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
if "%1" == "xml" (
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The XML files are in %BUILDDIR%/xml.
goto end
)
if "%1" == "pseudoxml" (
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
goto end
)
:end

1
docs/todo.rst

@ -0,0 +1 @@
.. include:: ../TODO.rst

7
docs/usage.rst

@ -0,0 +1,7 @@
========
Usage
========
.. automodule:: kolibri.utils.cli
:undoc-members:
:show-inheritance:

5
kolibri/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
__author__ = 'Learning Equality'
__email__ = 'info@learningequality.org'
__version__ = '0.0.1'

6
kolibri/__main__.py

@ -0,0 +1,6 @@
import sys
if __name__ == "__main__":
from kolibri.utils.cli import main
main(args=sys.argv[1:])

10
kolibri/core/__init__.py

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
"""TODO: Write something about this module (everything in the docstring
enters the docs)
.. moduleauthor:: Learning Equality <info@learningequality.org>
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import

28
kolibri/core/kolibri_plugin.py

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
"""
The core app of Kolibri also uses the plugin API <3
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
from kolibri.plugins.base import KolibriPluginBase
from kolibri.plugins.hooks import NAVIGATION_POPULATE
class KolibriCore(KolibriPluginBase):
def main_navigation(self):
return [{
'menu_name': _("Start page"),
'menu_url': reverse('kolibri:index'),
}]
def hooks(self):
return {
NAVIGATION_POPULATE: self.main_navigation
}

8
kolibri/core/models.py

@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from kolibri.plugins import registry
registry.initialize()

25
kolibri/core/templates/kolibri/base.html

@ -0,0 +1,25 @@
{% load i18n kolibri_tags %}<html>
<head>
<title>{% block title %}{% endblock %} - {% trans "Kolibri" %}</title>
</head>
<body>
{% block main_menu %}
<ul role="nav">
{% kolibri_main_navigation as nav %}
{% for item in nav %}
<li><a href="{{ item.menu_url }}">{{ item.menu_name }}</a></li>
{% endfor %}
</ul>
{% endblock %}
<hr>
{% block content %}
{% endblock %}
</body>
</html>

1
kolibri/core/templates/kolibri/index.html

@ -0,0 +1 @@
{% extends "kolibri/todo.html" %}

9
kolibri/core/templates/kolibri/todo.html

@ -0,0 +1,9 @@
{% extends "kolibri/base.html" %}
{% block title %}TODO{% endblock %}
{% block content %}
<h1>Work in progress</h1>
This page is a stub. Meaning something should be here but is not yet complete.
{% endblock %}

0
kolibri/core/templatetags/__init__.py

36
kolibri/core/templatetags/kolibri_tags.py

@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
"""
Kolibri template tags
=====================
To use
.. code-block:: html
{% load kolibri_tags %}
<ul>
{% for navigation in kolibri_main_navigation %}
<li><a href="{{ navigation.menu_url }}">{{ navigation.menu_name }}</a></li>
{% endfor %}
</ul>
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from django import template
register = template.Library()
from kolibri.plugins import hooks
@register.assignment_tag()
def kolibri_main_navigation():
for callback in hooks.get_callables(hooks.NAVIGATION_POPULATE):
for item in callback():
yield item

19
kolibri/core/urls.py

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
"""TODO: Write something about this module (everything in the docstring
enters the docs)
.. moduleauthor:: Learning Equality <info@learningequality.org>
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from django.conf.urls import url
from . import views
urlpatterns = [
url('^', views.IndexView.as_view(), name='index'),
# url('.* ', views.TODOView.as_view())
]

24
kolibri/core/views/__init__.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
"""TODO: Write something about this module (everything in the docstring
enters the docs)
.. moduleauthor:: Learning Equality <info@learningequality.org>
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from django.views.generic.base import TemplateView
class IndexView(TemplateView):
template_name = "kolibri/index.html"
class TODOView(TemplateView):
"""While sketching, use this view to visually inform users that a page
is not yet in place."""
template_name = "kolibri/todo.html"

0
kolibri/deployment/__init__.py

0
kolibri/deployment/default/__init__.py

BIN
kolibri/deployment/default/db.sqlite3

Binary file not shown.

4
kolibri/deployment/default/settings/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import

111
kolibri/deployment/default/settings/base.py

@ -0,0 +1,111 @@
# -*- coding: utf-8 -*-
"""
Django settings for kolibri project.
Generated by 'django-admin startproject' using Django 1.8.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
# This is essential! We load the kolibri conf INSIDE the Django conf
from kolibri.utils import conf
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'f@ey3)y^03r9^@mou97apom*+c1m#b1!cwbm50^s4yk72xce27'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'kolibri.core',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
] + conf.config['INSTALLED_APPS']
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)
ROOT_URLCONF = 'kolibri.deployment.default.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'kolibri.deployment.default.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(conf.KOLIBRI_HOME, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_URL = '/static/'

30
kolibri/deployment/default/urls.py

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
"""kolibri URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Add an import: from blog import urls as blog_urls
2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
.. moduleauthor:: Learning Equality <info@learningequality.org>
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'', include('kolibri.core.urls', namespace='kolibri')),
]

16
kolibri/deployment/default/wsgi.py

@ -0,0 +1,16 @@
"""
WSGI config for kolibri project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kolibri.deployment.default.settings.base")
application = get_wsgi_application()

26
kolibri/logger.py

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
import logging
from colorlog import ColoredFormatter
# TODO: Logging decision.
# The main Kolibri logger always logs to console and does not propagate.
LOG_LEVEL = logging.DEBUG
LOGFORMAT = " %(log_color)s%(levelname)-8s%(reset)s | %(log_color)s%(message)s%(reset)s"
logging.root.setLevel(LOG_LEVEL)
formatter = ColoredFormatter(LOGFORMAT)
stream = logging.StreamHandler()
stream.setLevel(LOG_LEVEL)
stream.setFormatter(formatter)
logger = logging.getLogger(__name__)
logger.setLevel(LOG_LEVEL)
logger.addHandler(stream)
logger.propagate = False
# For now, logging for test output is the same
test_logger = logger

4
kolibri/plugins/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import

49
kolibri/plugins/base.py

@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
"""The base of a Kolibri plugin is the inheritence from
:class:`.KolibriPluginBase`.
.. moduleauthor:: Learning Equality <info@learningequality.org>
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
class MandatoryPluginMethodNotImplemented(Exception):
def __init__(self):
NotImplemented.__init__(self, "Plugin needs to define this method")
class KolibriPluginBase(object):
"""
This is the base class that all Kolibri plugins need to implement.
"""
#: Suggested property, not yet in use
migrate_on_enable = False
#: Suggested property, not yet in use
collect_static_on_enable = False
#: Suggested property, not yet in use
collect_static_on_enable = False
def hooks(self):