Deploying GeoDjango

Basically, the deployment of a GeoDjango application is not different from the deployment of a normal Django application. Please consult Django’s deployment documentation. Warning GeoDjango uses the GDAL geospatial library which is not thread safe at this time. Thus, it is highly recommended to not use threading when deploying – in other words, use an appropriate configuration of Apache. For example, when configuring your application with mod_wsgi, set the WSGIDaemonProcess attribute threads t

db.transaction.commit()

commit(using=None) [source]

db.transaction.get_rollback()

get_rollback(using=None) [source]

db.transaction.get_autocommit()

get_autocommit(using=None) [source]

db.transaction.non_atomic_requests()

non_atomic_requests(using=None) [source] This decorator will negate the effect of ATOMIC_REQUESTS for a given view: from django.db import transaction @transaction.non_atomic_requests def my_view(request): do_stuff() @transaction.non_atomic_requests(using='other') def my_other_view(request): do_stuff_on_the_other_database() It only works if it’s applied to the view itself.

db.transaction.on_commit()

on_commit(func, using=None) [source] Pass any function (that takes no arguments) to on_commit(): from django.db import transaction def do_something(): pass # send a mail, invalidate a cache, fire off a Celery task, etc. transaction.on_commit(do_something) You can also wrap your function in a lambda: transaction.on_commit(lambda: some_celery_task.delay('arg1')) The function you pass in will be called immediately after a hypothetical database write made where on_commit() is called wou

db.transaction.rollback()

rollback(using=None) [source] These functions take a using argument which should be the name of a database. If it isn’t provided, Django uses the "default" database. Django will refuse to commit or to rollback when an atomic() block is active, because that would break atomicity.

db.models.Value

class Value(value, output_field=None) [source] A Value() object represents the smallest possible component of an expression: a simple value. When you need to represent the value of an integer, boolean, or string within an expression, you can wrap that value within a Value(). You will rarely need to use Value() directly. When you write the expression F('field') + 1, Django implicitly wraps the 1 in a Value(), allowing simple values to be used in more complex expressions. You will need to use

db.models.Variance

class Variance(expression, sample=False, **extra) [source] Returns the variance of the data in the provided expression. Default alias: <field>__variance Return type: float Has one optional argument: sample By default, Variance returns the population variance. However, if sample=True, the return value will be the sample variance. SQLite SQLite doesn’t provide Variance out of the box. An implementation is available as an extension module for SQLite. Consult the SQlite document

db.transaction.clean_savepoints()

clean_savepoints(using=None) [source] Resets the counter used to generate unique savepoint IDs. The following example demonstrates the use of savepoints: from django.db import transaction # open a transaction @transaction.atomic def viewfunc(request): a.save() # transaction now contains a.save() sid = transaction.savepoint() b.save() # transaction now contains a.save() and b.save() if want_to_keep_b: transaction.savepoint_commit(sid) # open transa