Skip to main content

django app for torque

Project description

The torque app

This is the django app that should be deployed in a running django server.

Outside of installing the app, this should remain a black box. The reason being that none of the routes or uses for this should be accessed except through the Torque MediaWiki plugin.

For developers, look in the individual code files for details on the inner workings.

Installation and Startup

Install via pip

$ pip install django-torque

Installation Configuration

Update your settings.py to include:

INSTALLED_APPS = [
    ...
    "torque",
    "torque.cache_rebuilder",
    ...
]

# and the urls
ROOT_URLCONF = "torque.urls"

For the urls, you can also do add them by the following:

urlpatterns = [
    ...
    path('torque/', include('torque.urls')),
    ...
]

If you do that, you need to make sure that your mediawiki extension is configured to the correct subpath (localhost:5000/torque/ or however)

Then run the migrations:

$ python manage.py migrate

App configuration

TORQUE_ENABLED_JINJA_EXTENSIONS

A list of jinja2 extensions to enable when rendering templates See an extension list: https://jinja.palletsprojects.com/en/2.11.x/extensions/ For example, to enable the "jinja2.ext.do" extension you would set this to

TORQUE_ENABLED_JINJA_EXTENSIONS=['jinja2.ext.do']

TORQUE_FILTERS

All the search filters for cached search items. These must implement utils.Filter, and that class has more documentation on what must be done.

In short, the filters must provide a name, translate the documents into in values that can be filtered upon.

from torque import utils
class ExampleFilter(utils.Filter):
    def name(self):
        return "example"

    def display_name(self):
        return "Example"

    def document_value(self, document):
        # Filter on the first character of the key
        return document.key[0]

FILTERS=[
    ExampleFilter()
]

TORQUE_CSV_PROCESS

When generating a csv, this dictionary will match against fields named in the keys, and the document will be processed through the value, which should be an instance of utils.CsvFieldProcessor

Running from this repository (in development)

Install a pipenv environment:

pipenv install

Set up your configuration via

$ cp config.py.tmpl config.py
$ $EDITOR config.py

Then run the migrations:

$ python manage.py migrate

Then start it up via normal django commands

$ pipenv run python manage.py runserver 5000

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

django-torque-0.2.2.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_torque-0.2.2-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file django-torque-0.2.2.tar.gz.

File metadata

  • Download URL: django-torque-0.2.2.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.2

File hashes

Hashes for django-torque-0.2.2.tar.gz
Algorithm Hash digest
SHA256 5d3e7d3c1a0dcd7b67f1df903610353016286f0042b54b29cd4c116c212a72a5
MD5 4a6c218156ecfe3609cf8a8c45cd79db
BLAKE2b-256 644672c84452ebdf5633b2bb0c937deb9fb08f4124870ab00f69ae36772f8211

See more details on using hashes here.

File details

Details for the file django_torque-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: django_torque-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.2

File hashes

Hashes for django_torque-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 892d1bd048a925b6e47d95d8b7e9ef5a6265c20d9674957b083a6509dfab8467
MD5 3d74242a46358ff7d91e3c47682596cf
BLAKE2b-256 b4ac4312af22e65b75bb362812aa9f28889bd2299e010027a55bcdff32737161

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page