Skip to main content

django-dartium

django-dartium provides for a simple way to detect the Dartium web browser and make it easy to serve Dart sources instead of compiled JavaScript during development.

Installation

Python 3 and Django are the only requirements:

  1. Install django-dartium with your favorite python tool, e.g. pip install django-dartium.

  2. Add django_dartium to your INSTALLED_APPS setting.

  3. Add django_dartium.middleware.DartiumDetectionMiddleware to your MIDDLEWARE_CLASSES setting.

  4. Add two named mappings to STATICFILES_DIRS, one named dart/build which points to the build location of the JavaScript output and the other is dart/src which points to the web directory containing your original Dart source. If you created your Django project by running django-admin startproject your_project and placed your Dart sources in your_project/your_project/dart directory, then you would have the following STATICFILES_DIRS:

    STATICFILES_DIRS = [
      ('dart/build', 'your_project/dart/build/web'),
      ('dart/src', 'your_project/dart/web'),
    ]

Usage

Load the dartium tag library into your Django template, call the webcomponents tag to load the necessary polyfills and then add a reference to your Dart code via the dart tag.

A good setup would be to have the following in your base.html:

{% load dartium %}
<html>
...
<body>
  {% block content %}
  {% endblock %}

  {% webcomponents 'lite' %}
  {% block script %}
  {% endblock %}
</body>
</html>

Then in each of your pages where you want to use Dart some Dart script you can add:

{% load dartium %}
{% block content %}
  ... page content ...
{% endblock %}
{% block script %}
  {% dart "your_script.dart" %}
{% endblock %}

The end result will be that if you browse to this page with Dartium you will get served your original Dart source but if you are using any other browser you’ll be served your_script.dart.js from the build/web directory.

0.1.3 - 2017-01-31

  • New style middlware to work with Django 2.0

0.1.0

  • Initial release.

Metadata

Release files for django-dartium 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-dartium 0.1.3
File Size Uploaded Provenance
django-dartium-0.1.3.tar.gz 3.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-dartium 0.1.3
File Interpreter ABI Platform
django_dartium-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 9.5 kB

Release files / django-dartium-0.1.3.tar.gz

Download URL django-dartium-0.1.3.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2c33ebc7b21dc70054dfc7947a6285c902dfacf8dbd60a17f8420909469a6792
BLAKE2b-256 checksum
How to use checksums
ac1c57b96206afdac25d596d65a1a6b90bc5225ade052b66f25238456c35303e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_dartium-0.1.3-py3-none-any.whl

Download URL django_dartium-0.1.3-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a42e284924fcd4833fa3eae71431126de74341176f7f902c8d36a383d98f766
BLAKE2b-256 checksum
How to use checksums
27fd83137ce267d0c4cea98a90e8f1389f5b3a899d1bf31e27631a039dd7a34e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-dartium 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page