Skip to main content

Django management command to simplify building extjs and sencha touch apps with Sencha tools.

Project description


Django management commands for the JSBuilder commands in `Sencha SDK Tools`_.
Unfortunately, the JSBuilder commands provided by Sencha Tools needs some
workarounds to work when the HTML document and resources are not in the same
directory. We have turned these workarounds into a Django management command
available in the *djangosenchatools* app.


Report any issues at the `github project page <djangosenchatools>`_, and feel free
to add your own guides/experiences to the wiki, and to contribute changes using
pull requests.


Install the python package::

$ pip install djangosenchatools

Add it to your django project::



First, we need a Django ExtJS4 application. See `django_extjs4_examples`_ for
an example application. We use the ``minimal_extjs4_app`` as our example.

.. note:: The ``senchatoolsbuild`` management command runs ``collectstatic``.

.. note:: You need to run the Django server (`` runserver``) for all commands except --listall.

Build one app


$ python senchatoolsbuild --url http://localhost:8000/minimal_extjs4_app/ --outdir /path/to/outdir

With ``--url`` and ``--outdir``, the senchatoolsbuild command runs ``sencha
create jsb`` and ``sencha build``, and puts the result in the ``--outdir``.
Run with ``-v3`` for full debug output if you want to see what the command does.


``senchatoolsbuild`` can autodetect sencha apps and build them all in their
respective static directories. Run with ``--help`` and see the help for
``--buildall`` to see how apps are detected.

To list detected apps, their ``--outdir`` and ``--url``, run::

$ python senchatoolsbuild --listall

Add ``-v3`` to see skipped apps, and why they are skipped.

To build all detected apps, run::

$ python senchatoolsbuild --buildall

Build one app by name

You can build a single app in ``INSTALLED_APPS`` using the same method of
detecting outdir and url as ``--buildall`` using ``--app``::

$ python senchatoolsbuild --app minimal_extjs4_app

Using --watch

Use ``--watch`` to automatically rebuild on file changes:

$ python senchatoolsbuild --app minimal_extjs4_app --watch /path/to/directory/containing/minimal_extjs4_app

Use ``-v2`` for debug out. By default, only ``*.js``-files trigger rebuild
events, however you can change this using these settings (shown with their defaults):

#: Files to include

#: Files to exclude
#: - Matched after INCLUDE, so you can include a general pattern, and
#: exclude specific files or dirs.
DJANGOSENCHATOOLS_WATCH_EXCLUDE = ['*.*.swp', '*~', '*.pyc', '*.pyo',
'*app-all.js', '*all-classes.js']

_Note_: All patterns match against the absolute path of the file.

Integration with django_extjs4

This app is made to work with `django_extjs4`_, however they are losely
coupled. The only place where you are likely to notice that they work together
is that ``senchatoolsbuild`` checks that ``settings.EXTJS4_DEBUG==True``. You
can disable this check using ``--no-check-settings``.

Building apps that require authentication

Add the following to your ````::

MIDDLEWARE_CLASSES += ['djangosenchatools.auth.SettingUserMiddleware']
AUTHENTICATION_BACKENDS = ('djangosenchatools.auth.SettingUserBackend',)

Where ``SENCHATOOLS_USER`` is the user that you want to be authenticated as
(the user must exist). **NEVER** use this backend/middleware in production.

Reccommended setup

We reccommend that you create a separate for ``senchatoolsbuild``
where you set the required settings. Here is our ````::

from settings import *
MIDDLEWARE_CLASSES += ['djangosenchatools.auth.SettingUserMiddleware']
AUTHENTICATION_BACKENDS = ('djangosenchatools.auth.SettingUserBackend',)

We use this settings module whenever we build apps using ``senchatoolsbuild``::

$ python senchatoolsbuild --buildall --settings djangosenchatools_settings

.. _`Sencha SDK Tools`:
.. _`django_extjs4`:
.. _`django_extjs4_examples`:
.. _`djangosenchatools`:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djangosenchatools-1.0.5.tar.gz (9.0 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page