-
Notifications
You must be signed in to change notification settings - Fork 305
Project structure
KA Lite is a medium-size project, so keeping a well-defined structure is essential to making it understandable.
Below is an outline of the directory structure for the project, as well as how apps are currently structured.
The KA Lite project has the following subdirectories:
- kalite - Django apps we've created or downloaded and modified for the ka lite projects
-
python-packages - Django apps and Python package dependencies for apps within
kalite
- scripts - OS-specific scripts for starting/stopping server (and other similar tasks)
- static-libraries - Downloaded static libraries that are shared across all apps.
- content - contains video files and video preview images
- docs - .md files for developers and KA Lite users
- locale - contains translations that are downloaded via language pack updates
Distributed server-specific - only used on the installable KA Lite server
- django_cherrypy_wsgiserver - wrapper around cherrypy for use in Django
- khanload - code and commands for downloading Khan Academy's topic tree and user data
- updates - sister app of chronograph; updates job status from back-end management commands to the front-end UI
Shared - Shared between both technologies
- coachreports - graphical displays of student progress
- control_panel - summaries of all data (usage and syncing)
- i18n - tools for implementing language packs, including interface translations, subtitles, and dubbed videos
- main - main website and student progress recording
- securesync - engine for syncing data, as well as defining users
- tests - framework for functional and performance testing
- utils - app-independent utilities (could be shared with the world!)
These are located in the python-packages
directory.
Shared FLE libraries
- fle_utils - includes:
- chronograph
- config
- playground
- securesync
True libraries - usually get via sudo apt-get
, but we download and ship for offline completeness
- cherrypy
- collections
- django
- httplib2
- pytz
- requests
- rsa
- selenium
- south
External helpers - Collected from around the web, we use this code without modification. ** NOTE **: many of these may belong to "true libraries" above.
- annoying
- dateutil
- debug_toolbar
- decorator
- django_extensions
- django_snippets
- git
- ifcfg
- iso8601
- khanacademy
- memory_profiler
- oauth
- pbkdf2
- polib
- postmark
- pyasn1
- werkzeug
Apps are now self-contained entities with as few inter-app and global project dependencies as possible.
- Each app contains relevant standard Django files (
forms.py
,models.py
,views.py
,urls.py
) - Some apps have both HTML views as well as API/JSON views. These are defined by
api_xxx.py
files, such asapi_views.py
,api_urls.py
, etc. - Any shared functions across the app/module with other apps should be defined within the
__init__.py
file - App-specific settings should be put inside the app's
settings.py
file. This includes required middleware and context processors. - App-related template files should be put inside the
{app}/templates/{app}/
folder (or any subfolders), and referenced as{app}/template.html
from view functions. - App-related static files should be put inside the
{app}/static/[css|images|js]/{app}/
folder, and referenced as{% static 'static/[css|images|js]/{app}/file.ext' %}
from template files.