2016-06-22 19:58:16 +02:00
|
|
|
# Directory structure
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
This page documents the Zulip directory structure, where to find
|
|
|
|
things, and how to decide where to put a file.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
You may also find the [new application feature
|
2016-06-28 05:54:18 +02:00
|
|
|
tutorial](new-feature-tutorial.html) helpful for understanding the
|
|
|
|
flow through these files.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
### Core Python files
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
Zulip uses the [Django web
|
|
|
|
framework](https://docs.djangoproject.com/en/1.8/), so a lot of these
|
|
|
|
paths will be familiar to Django developers.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2017-01-05 23:23:16 +01:00
|
|
|
* `zproject/urls.py` Main
|
|
|
|
[Django routes file](https://docs.djangoproject.com/en/1.8/topics/http/urls/).
|
|
|
|
Defines which URLs are handled by which view functions or templates.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2017-01-05 23:23:16 +01:00
|
|
|
* `zerver/models.py` Main
|
|
|
|
[Django models](https://docs.djangoproject.com/en/1.8/topics/db/models/)
|
|
|
|
file. Defines Zulip's database tables.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
|
|
|
* `zerver/lib/actions.py` Most code doing writes to user-facing database tables.
|
|
|
|
|
|
|
|
* `zerver/views/*.py` Most [Django views](https://docs.djangoproject.com/en/1.8/topics/http/views/).
|
|
|
|
|
2017-01-26 16:58:23 +01:00
|
|
|
* `zerver/webhooks/` Webhook views and tests for [Zulip webhook integrations](integration-guide.html).
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2016-11-27 06:50:54 +01:00
|
|
|
* `zerver/tornado/views.py` Tornado views.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2016-06-28 05:54:18 +02:00
|
|
|
* `zerver/worker/queue_processors.py` [Queue workers](queuing.html).
|
2016-06-22 20:26:34 +02:00
|
|
|
|
|
|
|
* `zerver/lib/*.py` Most library code.
|
|
|
|
|
2016-06-28 05:54:18 +02:00
|
|
|
* `zerver/lib/bugdown/` [Backend Markdown processor](markdown.html).
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2016-07-27 04:00:29 +02:00
|
|
|
* `zproject/backends.py` [Authentication backends](https://docs.djangoproject.com/en/1.8/topics/auth/customizing/).
|
2016-06-22 19:59:20 +02:00
|
|
|
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
### HTML Templates
|
|
|
|
|
2016-06-28 05:54:18 +02:00
|
|
|
See [our translating docs](translating.html) for details on Zulip's
|
|
|
|
templating systems.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2017-01-05 23:23:16 +01:00
|
|
|
* `templates/zerver/` For [Jinja2](http://jinja.pocoo.org/) templates
|
|
|
|
for the backend (for zerver app).
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
* `static/templates/` [Handlebars](http://handlebarsjs.com/) templates for the frontend.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
|
|
|
----------------------------------------
|
|
|
|
|
2016-07-13 04:22:21 +02:00
|
|
|
### JavaScript and other static assets
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2016-07-13 04:22:21 +02:00
|
|
|
* `static/js/` Zulip's own JavaScript.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
|
|
|
* `static/styles/` Zulip's own CSS.
|
|
|
|
|
|
|
|
* `static/images/` Zulip's images.
|
|
|
|
|
2016-07-13 04:22:21 +02:00
|
|
|
* `static/third/` Third-party JavaScript and CSS that has been vendored.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2016-07-13 04:22:21 +02:00
|
|
|
* `node_modules/` Third-party JavaScript installed via `npm`.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2016-08-26 05:06:07 +02:00
|
|
|
* `static/assets/` For assets not to be served to the web (e.g. the system to
|
|
|
|
generate our favicons).
|
2016-06-22 19:59:20 +02:00
|
|
|
|
|
|
|
-----------------------------------------------------------------------
|
|
|
|
|
|
|
|
### Tests
|
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
* `zerver/tests/` Backend tests.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
* `frontend_tests/node_tests/` Node Frontend unit tests.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
* `frontend_tests/casper_tests/` Casper frontend tests.
|
|
|
|
|
|
|
|
* `tools/test-*` Developer-facing test runner scripts.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
|
|
|
-----------------------------------------------------
|
|
|
|
|
|
|
|
### Management commands
|
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
These are distinguished from scripts, below, by needing to run a
|
|
|
|
Django context (i.e. with database access).
|
|
|
|
|
2016-06-22 19:59:20 +02:00
|
|
|
* `zerver/management/commands/` Management commands one might run at a
|
|
|
|
production deployment site (e.g. scripts to change a value or
|
2016-06-22 20:26:34 +02:00
|
|
|
deactivate a user properly).
|
2016-06-22 19:59:20 +02:00
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
2016-06-22 19:58:16 +02:00
|
|
|
### Scripts
|
2016-05-15 18:28:38 +02:00
|
|
|
|
|
|
|
* `scripts/` Scripts that production deployments might run manually
|
|
|
|
(e.g., `restart-server`).
|
|
|
|
|
|
|
|
* `scripts/lib/` Scripts that are needed on production deployments but
|
2016-06-22 19:56:23 +02:00
|
|
|
humans should never run directly.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2016-06-22 19:56:23 +02:00
|
|
|
* `scripts/setup/` Scripts that production deployments will only run
|
2016-05-15 18:28:38 +02:00
|
|
|
once, during installation.
|
|
|
|
|
2016-06-22 19:56:23 +02:00
|
|
|
* `tools/` Scripts used only in a Zulip development environment.
|
|
|
|
These are not included in production release tarballs for Zulip, so
|
|
|
|
that we can include scripts here one wouldn't want someone to run in
|
|
|
|
production accidentally (e.g. things that delete the Zulip database
|
|
|
|
without prompting).
|
|
|
|
|
|
|
|
* `tools/setup/` Subdirectory of `tools/` for things only used during
|
|
|
|
the development environment setup process.
|
|
|
|
|
|
|
|
* `tools/travis/` Subdirectory of `tools/` for things only used to
|
2017-01-15 05:13:22 +01:00
|
|
|
setup and run our tests in Travis CI. Actual test suites should
|
2016-06-22 19:56:23 +02:00
|
|
|
go in `tools/`.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
|
|
|
---------------------------------------------------------
|
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
### API and Bots
|
|
|
|
|
|
|
|
* `api/` Zulip's Python API bindings (released separately).
|
|
|
|
|
|
|
|
* `api/examples/` API examples.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
|
|
|
* `api/integrations/` Bots distributed as part of the Zulip API bundle.
|
|
|
|
|
|
|
|
* `bots/` Previously Zulip internal bots. These usually need a bit of
|
|
|
|
work.
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------
|
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
### Production puppet configuration
|
|
|
|
|
|
|
|
This is used to deploy essentially all configuration in production.
|
|
|
|
|
|
|
|
* `puppet/zulip/` For configuration for production deployments.
|
|
|
|
|
|
|
|
* `puppet/zulip/manifests/voyager.pp` Main manifest for Zulip standalone deployments.
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------
|
|
|
|
|
|
|
|
### Additional Django apps
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
* `confirmation` Email confirmation system.
|
|
|
|
|
2016-07-27 04:00:29 +02:00
|
|
|
* `analytics` Analytics for the Zulip server administrator (needs work to
|
2016-06-22 20:26:34 +02:00
|
|
|
be useful to normal Zulip sites).
|
|
|
|
|
|
|
|
* `corporate` The old Zulip.com website. Not included in production
|
|
|
|
distribution.
|
|
|
|
|
|
|
|
* `zilencer` Primarily used to hold management commands that aren't
|
|
|
|
used in production. Not included in production distribution.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2016-06-22 19:59:20 +02:00
|
|
|
-----------------------------------------------------------------------
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2016-06-22 19:58:16 +02:00
|
|
|
### Jinja2 Compatibility Files
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
* `zproject/jinja2/__init__.py` Jinja2 environment.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
* `zproject/jinja2/backends.py` Jinja2 backend.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
|
|
|
* `zproject/jinja2/compressors.py` Jinja2 compatible functions of
|
2016-06-22 20:26:34 +02:00
|
|
|
Django-Pipeline.
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------
|
|
|
|
|
|
|
|
### Translation files
|
|
|
|
|
|
|
|
* `locale/` Backend (Django) translations data files.
|
|
|
|
|
|
|
|
* `static/locale/` Frontend translations data files.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
|
|
|
-----------------------------------------------------------------------
|
|
|
|
|
2016-06-22 19:58:16 +02:00
|
|
|
### Documentation
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
* `docs/` Source for this documentation.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
|
|
|
--------------------------------------------------------------
|
|
|
|
|
|
|
|
You can consult the repository's `.gitattributes` file to see exactly
|
|
|
|
which components are excluded from production releases (release
|
|
|
|
tarballs are generated using `tools/build-release-tarball`).
|