Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs setup customizing #3925

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion kalite/control_panel/views.py
Expand Up @@ -407,7 +407,9 @@ def account_management(request):
# Never report this error; don't want this logging to block other functionality.
logging.error("Failed to update student userlog activity: %s" % e)

return student_view_context(request)
c = student_view_context(request)
c['restricted'] = settings.DISABLE_SELF_ADMIN
return c


# data functions
Expand Down
1 change: 1 addition & 0 deletions kalite/distributed/custom_context_processors.py
Expand Up @@ -34,4 +34,5 @@ def custom(request):
"True": True,
"False": False,
"is_config_package_nalanda": "nalanda" in settings.CONFIG_PACKAGE,
"inline_help": getattr(settings, "INLINE_HELP", False)
}
8 changes: 0 additions & 8 deletions kalite/distributed/inline_context_processor.py

This file was deleted.

12 changes: 0 additions & 12 deletions kalite/facility/custom_context_processors.py

This file was deleted.

2 changes: 0 additions & 2 deletions kalite/settings/base.py
Expand Up @@ -367,10 +367,8 @@
'kalite.i18n.custom_context_processors.languages',
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.request',
'kalite.facility.custom_context_processors.custom',
'kalite.distributed.custom_context_processors.custom',
'django.contrib.messages.context_processors.messages',
'kalite.distributed.inline_context_processor.inline',
] + getattr(local_settings, 'TEMPLATE_CONTEXT_PROCESSORS', [])


Expand Down
31 changes: 30 additions & 1 deletion sphinx-docs/developer_docs/index.rst
@@ -1,3 +1,32 @@
Setting up your development environment
=======================================

KA Lite is like a normal django project, if you have done Django before, you will recognize most of these steps.

1. Check out the project from our _`github`
1. Create a virtual environment "kalite" that you will work in:
.. ::
sudo pip install virtualenvwrapper
mkvirtualenv kalite
workon kalite
1. Install kalite in your virtualenv in "editable" mode, meaning that the source is just linked:
.. ::
cd path/to/repo
pip install -e .
1. Install additional development tools:
.. ::
pip install -r requirements.txt
1. Run a development server and use development settings like this:
.. ::
kalite manage runserver --settings=kalite.project.settings.dev


Now, everytime you work on your development environment, just remember to switch on your virtual environment with `workon kalite`. This can be done automatically with _`oh-my-zsh`.

.. _github: https://github.com/learningequality/ka-lite
.. _oh-my-zsh: https://github.com/


Developer Docs
==============

Expand All @@ -9,4 +38,4 @@ Useful stuff our devs think that the rest of our devs ought to know about.
Behavior-Driven Integration Tests <behave_testing>
Profiling KA Lite <profiling>
Developer Utility Commands <utility>
Logging <logging>
Logging <logging>
65 changes: 45 additions & 20 deletions sphinx-docs/usermanual/userman_admin.rst
Expand Up @@ -615,24 +615,52 @@ Once you have deployed KA Lite to a computer, there are a number of ways you can

.. warning:: Please follow these instructions carefully! Customizing the server incorrectly can break your installation. It can be very hard to find and undo the error.

A more advanced way to customize your installation's behavior is by adding a file called `local_settings.py` in the `kalite` folder (the same folder that has `version.py`). Below is a list of options that you can set in `local_settings.py`, and what they mean.
As of version 0.9.3 (Dec, 2012):
Running KA Lite with your own settings
______________________________________

Create a new file, ``my_settings.py`` with the following content:

.. ::
from kalite.project.settings.base import *
# Put your settings here, e.g.
# MY_SETTING_VAR = 123

That file is where you should put your custom settings!

In order to make kalite run with your custom settings, any KA Lite command needs to append ``--settings=my_settings`` (notice there is no .py, we are pointing at a Python module, not a file). You would also have to run the `kalite` command from within the directory where the file is stored.


Available settings
__________________


Most common settings
^^^^^^^^^^^^^^^^^^^^

* DEBUG = <True or False> (default = False) -- Enables debug mode. In case you run into technical issues, enable this setting before troubleshooting / reporting.
* CONTENT_ROOT = "<path to desired content folder>" (default=ka-lite/content)
This is the path that KA Lite will use to look for KA Lite video files to play. Change the path to another local directory to get video files from that directory.
This is the path that KA Lite will use to look for KA Lite video files to play. Change the path to another local directory to get video files from that directory. NB! Directory has to be writable for the user running the server in order to download videos.
* TIME_ZONE = <desired time zone> (default = "America/Los_Angeles")
You can set this to be the local time zone for your installation. Choices can be found here.
* LANGUAGE_CODE = "<desired ISO 639-1 Language Code>" (default = "en-us")
You can set this to the desired language code for this installation (All choices can be found here). If there are translations available, our web server will show them in KA Lite. Soon, we hope to provide support for internationalized content inside the KA Lite interface.
* USE_I18N = <True or False> (default = True)
If you set this to False, our web server will make some optimizations so as to avoid loading internationalization tools. Things might run a little faster, but you won't have support for translated content.
* USE_L10N = True
* USE_L10N = <True or False> (default = True)
By default, this is set to False. If you set this to True, Django will format dates, numbers and calendars according to the current locale. For example, January 5, 2000 would be 1/5/2000 if locale = "en-us" and 5/1/2000 if locale = "en-gb"

New in version 0.10.0 (August 26, 2013):

* PRODUCTION_PORT = <desired port number> (default=8008)
This is the port that KA Lite will run on when started. Here is a list of available ports.
User restrictions
^^^^^^^^^^^^^^^^^

* LOCKDOWN = <True or False> (default = False)
With this setting, users must be logged in order to access videos & exercises
* DISABLE_SELF_ADMIN = <True or False> (default = False). Disables user sign ups.


Online Synchronization
^^^^^^^^^^^^^^^^^^^^^^

* USER_LOG_MAX_RECORDS = <desired maxium for user log records> (default = 0)
When this is set to any non-zero number, we will record (and sync for online tracking) user login activity, summarized for every month (which is configurable, see below). Default is set to 0, for efficiency purposes--but if you want to record this, setting to 1 is enough! The # of records kept are not "summary" records, but raw records of every login. These "raw" data are not synced, but are kept on your local machine only--there's too many of them. Currently, we have no specific report to view these data (though we may have for v0.10.1)
* USER_LOG_SUMMARY_FREQUENCY = <desired frequency in the following format (number, amount of time)> (default = (1, "months")
Expand All @@ -643,6 +671,11 @@ New in version 0.10.0 (August 26, 2013):
Every time your installation syncs data, we record the time of the sync, the # of successful logs that were uploaded and downloaded, and any failures.
This setting is how many such records we keep on your local server, for display.
When you log in to our online server, you will see a *full* history of these records.


Optimization of storage and system load
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* CRONSERVER_FREQUENCY = <desired frequency of cronserver to run in seconds> (default = 10 minutes)
This is how frequently KA Lite tries to synchronize user data with other Devices on your Zone. This can be changed to sync data more often (use a smaller #), or if you're never online (can be set to a large number)
* CACHE_TIME = <desired length of cache time, in seconds> (default = 5*365*24*60*60) (that's 5 years!)
Expand All @@ -653,20 +686,12 @@ New in version 0.10.0 (August 26, 2013):
Some operating systems will clear the temporary directories when the system is rebooted. To retain the cache between reboots, an alternative location can be specified. (for example on Linix, "/var/tmp/kalite_web_cache")
* CHERRYPY_THREAD_COUNT = <number of threads> (default=50)
The CherryPy Webserver can handle multiple page requests simultaneously. The default is 50, but for slow or single CPU servers, performance will be improved if the number of threads is reduced. Minimum number of threads is 10, optimum setting for Raspberry Pi is 18.
* USE_MPLAYER = <True or False> (default = False)
With this setting, if the browser is run from the same computer as the KA Lite server, then instead of playing the video in the browser, the video will be launched outside of the browser and played in mplayer - a light-weight video player that is included with the KA Lite software.
This is intended for use only on the Raspberry Pi, where no other video player is available.

New in version 0.11.1 (March 12, 2014):

* LOCKDOWN = <True or False> (default = False)
With this setting, users must be logged in order to access videos & exercises
* CONFIG_PACKAGE = “<Desired Config Package>”
Allows enabling of different config packages to enable commonly requested custom behaviors.
"UserRestricted" - Doesn't allow users to sign up themselves

Finally, if you examine the various `settings.py` files in the app (there is more than one such file) you will frequently see variables set with the following syntax::
Raspberry Pi
^^^^^^^^^^^^

DEBUG = getattr(local_settings, "DEBUG", False)
* USE_MPLAYER = <True or False> (default = False)
With this setting, if the browser is run from the same computer as the KA Lite server, then instead of playing the video in the browser, the video will be launched outside of the browser and played in mplayer - a light-weight video player that is included with the KA Lite software.
This is intended for use only on the Raspberry Pi, where no other video player is available.

This is essentially checking first to see if DEBUG is set in local_settings. If it is, use that, if not, set it to False. Any variable set with this syntax in settings.py can be overwritten in local_settings.py. Again, don't change anything on a live installation that you aren't sure about, but for testing purposes, feel free to experiment!