Settings¶
ievvtasks_dump_db_as_json¶
IEVVTASKS_DUMPDATA_DIRECTORY¶
The directory where we put dumps created by the ievvtasks_dump_db_as_json
management command. Typically, you put something like this in your develop settings:
THIS_DIR = os.path.dirname(__file__)
IEVVTASKS_DUMPDATA_DIRECTORY = os.path.join(THIS_DIR, 'dumps')
IEVVTASKS_DUMPDATA_ADD_EXCLUDES¶
Use this setting to add models and apps to exclude from the dumped json. We exclude:
- contenttypes
- auth.Permission
- sessions.Session
By default, and we exclude thumbnail.KVStore
by default if sorl.thumbnail
is
in installed apps, and the THUMBNAIL_KVSTORE
setting is configured to use the
database (sorl.thumbnail.kvstores.cached_db_kvstore.KVStore
).
Example:
IEVVTASKS_DUMPDATA_ADD_EXCLUDES = [
'auth.Group',
'myapp.MyModel',
]
IEVVTASKS_DUMPDATA_EXCLUDES¶
If you do not want to get the default excludes, you can use this instead of
IEVVTASKS_DUMPDATA_ADD_EXCLUDES
to specify exactly what to
exclude.
ievvtasks_makemessages¶
IEVVTASKS_MAKEMESSAGES_LANGUAGE_CODES¶
The languages to build translations for. Example:
IEVVTASKS_MAKEMESSAGES_LANGUAGE_CODES = ['en', 'nb']
IEVVTASKS_MAKEMESSAGES_IGNORE¶
The patterns to ignore when making translations. Defaults to:
IEVVTASKS_MAKEMESSAGES_IGNORE = [
'static/*'
]
IEVVTASKS_MAKEMESSAGES_DIRECTORIES¶
Directories to run makemessages and compilemessages in. Defaults to a list with the
current working directory as the only item. The use case for this setting is if you
have your translation files split over multiple apps or directories. Then you can use
this setting to specify the parent directories of all your locale
directories.
Lets say you have this structure:
myproject/
usersapp/
locale/
untranslatedapp/
themeapp/
locale/
You can then configure ievv makemessages
and ievv compilemessages
to
build the translations in myproject.usersapp
and myproject.themeapp
with
the following setting:
IEVVTASKS_MAKEMESSAGES_DIRECTORIES = [
'myproject/usersapp',
'myproject/themeapp',
]
Just adding strings to IEVVTASKS_MAKEMESSAGES_DIRECTORIES
is just a shortcut.
You can add dicts instead:
IEVVTASKS_MAKEMESSAGES_DIRECTORIES = [
{
'directory': 'myproject/usersapp',
},
{
'directory': 'myproject/themeapp',
'python': True, # Build python translations
'javascript': True, # Build javascript translations
# 'javascript_ignore': ['something/*'], # Override IEVVTASKS_MAKEMESSAGES_JAVASCRIPT_IGNORE for the directory
# 'python_ignore': ['something/*'], # Override IEVVTASKS_MAKEMESSAGES_IGNORE for the directory
}
]
IEVVTASKS_MAKEMESSAGES_BUILD_JAVASCRIPT_TRANSLATIONS¶
Set this to True
if you want to built translations for javascript code. Defaults to False
.
IEVVTASKS_MAKEMESSAGES_JAVASCRIPT_IGNORE¶
The patterns to ignore when making javascript translations. Defaults to:
IEVVTASKS_MAKEMESSAGES_JAVASCRIPT_IGNORE = [
'node_modules/*',
'bower_components/*',
'not_for_deploy/*',
]
IEVVTASKS_MAKEMESSAGES_PRE_MANAGEMENT_COMMANDS¶
Iterable of managemement commands to run before running makemessages. Example:
IEVVTASKS_MAKEMESSAGES_PRE_MANAGEMENT_COMMANDS = [
{
'name': 'ievvtasks_buildstatic',
'options': {
'includegroups': ['i18n']
}
}
]
Defaults to empty list.
The items in the iterable can be one of:
- A string with the name of a management command (for commands without any arguments or options).
- A dict with
name
,args
, andoptions
keys. Thename
key is required, butargs
andoptions
are optional.args
andoptions
is just forwarded todjango.core.management.call_command
.
IEVVTASKS_MAKEMESSAGES_EXTENSIONS¶
Extensions to look for strings marked for translations in
normal python/django code (for the django
–domain for makemessages).
Defaults to ['py', 'html', 'txt']
.
IEVVTASKS_MAKEMESSAGES_JAVASCRIPT_EXTENSIONS¶
Extensions to look for strings marked for translations in
javascript code (for the djangojs
–domain for makemessages).
Defaults to ['js']
.
ievvtasks_docs¶
IEVVTASKS_DOCS_DIRECTORY¶
The directory where your sphinx docs resides (the directory where you have your sphinx conf.py
).
Defaults to not_for_deploy/docs/
.
IEVVTASKS_DOCS_BUILD_DIRECTORY¶
The directory where your sphinx docs should be built.
Defaults to not_for_deploy/docs/_build
.
ievvtasks_recreate_devdb¶
IEVVTASKS_RECREATE_DEVDB_POST_MANAGEMENT_COMMANDS¶
Iterable of managemement commands to after creating/restoring and migrating the
database in ievv recreate_devdb
. Example:
IEVVTASKS_RECREATE_DEVDB_POST_MANAGEMENT_COMMANDS = [
{
'name': 'createsuperuser',
'args': ['test@example.com'],
'options': {'verbosity': 3}
},
'ievvtasks_set_all_passwords_to_test',
]
The items in the iterable can be one of:
- A string with the name of a management command (for commands without any arguments or options).
- A dict with
name
,args
, andoptions
keys. Thename
key is required, butargs
andoptions
are optional.args
andoptions
is just forwarded todjango.core.management.call_command
.
ievv_tagframework¶
IEVV_TAGFRAMEWORK_TAGTYPE_CHOICES¶
The legal values for ievv_opensource.ievv_tagframework.models.Tag.tagtype
.
Example:
IEVV_TAGFRAMEWORK_TAGTYPE_CHOICES = [
('', ''),
('mytype', 'My tag type'),
]
ievv devrun¶
IEVVTASKS_DEVRUN_RUNNABLES¶
Dict mapping ievv devrun
target names to ievv_opensource.utils.ievvdevrun.config.RunnableThreadList
objects. Must contain the "default"
key.
Documented in ievv devrun — All your development servers in one command.
ievv_elasticsearch¶
IEVV_ELASTICSEARCH_URL¶
The URL of the elasticsearch instance.
IEVV_ELASTICSEARCH_TESTURL¶
The URL where we run elasticsearch for UnitTests.
We provide a config file in not_for_deploy/elasticsearch.unittest.yml
used with:
$ elasticsearch --config=path/to/elasticsearch.unittest.yml
to configure elasticsearch in a manner suitable for Unit testing as long as this setting is set to:
IEVV_ELASTICSEARCH_TESTURL = 'http://localhost:9251'
IEVV_ELASTICSEARCH_TESTMODE¶
Set this to True to make ElasticSearch behave in a manner that makes writing Unit tests a bit easier:
- Automatically refresh the indexes after any index update.
- Use
IEVV_ELASTICSEARCH_TESTURL
instead ofIEVV_ELASTICSEARCH_URL
.
Add the following to you test settings to enable testmode:
IEVV_ELASTICSEARCH_TESTMODE = True
IEVV_ELASTICSEARCH_PRETTYPRINT_ALL_SEARCH_QUERIES¶
Set this to True to prettyprint all ElasticSearch search queries. Defaults to False
.
Good for debugging.
IEVV_ELASTICSEARCH_PRETTYPRINT_ALL_REQUESTS¶
Set this to True to prettyprint all ElasticSearch requests (both input and output).
Defaults to False
. Good for debugging.
IEVV_ELASTICSEARCH_AUTOREFRESH_AFTER_INDEXING¶
Automatically refresh after indexing with meth:ievv_opensource.ievv_elasticsearch.searchindex.AbstractIndex.index_items. Useful for unit tests, but not much else.
You should not add this to your test settings, but use it in your tests where appropriate like this:
class MyTestCase(TestCase):
def test_something(self):
with self.settings(IEVV_ELASTICSEARCH_AUTOREFRESH_AFTER_INDEXING=False):
# test something here
IEVV_ELASTICSEARCH_DO_NOT_REGISTER_INDEX_UPDATE_TRIGGERS¶
Do not register index update triggers on Django startup? Defaults to False
.
Mostly useful during development.
IEVV_ELASTICSEARCH_MAJOR_VERSION¶
The major version of elasticsearch you are using. Defaults to 1
, but we also
support 2
.
ievv_elasticsearch2¶
IEVV_ELASTICSEARCH2_CONNECTION_ALIASES¶
Setup elasticsearch connections (almost exactly like setting up Django databases). Example:
IEVV_ELASTICSEARCH2_CONNECTION_ALIASES = {
'default': {
'host': '127.0.0.1',
'port': '9251'
},
'theother': {
'host': '127.0.0.1',
'port': '9254'
}
}
The inner dict (the one with host and port) are kwargs for
elasticsearch.client.Elasticsearch
. These configurations
are all registered with elasticsearch_dsl.connections.Connections
.
This means that you can call elasticsearch_dsl.connections.connections.get_connection(alias=<alias>)
to get an elasticsearch.client.Elasticsearch
object with the configured connection
settings:
from elasticsearch_dsl.connections import connections
default_elasticsearch = connections.get_connection() # defaults to alias="default"
theother_elasticsearch = connections.get_connection(alias="theother")
Elasticsearch-dsl also uses elasticsearch_dsl.connections.Connections
, so this
means that you can use these aliases with elasticsearch_dsl.search.Search.using()
and ievv_opensource.ievv_elasticsearch2.search.Search.using()
:
from ievv_opensource import ievv_elasticsearch2
result = ievv_elasticsearch2.Search()\
.query('match', name='Peter')\
.using('theother')
.execute()
Note
The IEVV_ELASTICSEARCH2_CONNECTION_ALIASES
setting only works if you add
ievv_elasticsearch2
to INSTALLED_APPS
with the AppConfig:
INSTALLED_APPS = [
# .. Other apps ...
"ievv_opensource.ievv_elasticsearch2.apps.IevvEsAppConfig",
]
IEVV_ELASTICSEARCH2_DEBUGTRANSPORT_PRETTYPRINT_ALL_REQUESTS¶
If this is True
, it makes ievv_opensource.ievv_elasticsearch2.transport.debug.DebugTransport
prettyprint all requests performed by any elasticsearch.client.Elasticsearch
object it is configured as the transport_class
for.
This does not work unless you use ievv_opensource.ievv_elasticsearch2.transport.debug.DebugTransport
as the transport class. This is easiest to achieve by just adding it to your
IEVV_ELASTICSEARCH2_CONNECTION_ALIASES
setting:
IEVV_ELASTICSEARCH2_CONNECTION_ALIASES = {
'default': {
'host': '<somehost>',
'port': '<someport>',
'transport_class': 'ievv_opensource.ievv_elasticsearch2.transport.debug.DebugTransport'
}
}
You may want to set this to True
to just see all elasticsearch requests and responses,
but you can also use this in tests to debug just some requests:
class MyTest(TestCase):
def test_something(self):
# ... some code here ...
with self.settings(IEVV_ELASTICSEARCH2_DEBUGTRANSPORT_PRETTYPRINT_ALL_REQUESTS=True):
# ... some elasticsearch queries here ...
# ... more code here ...
IEVV_ELASTICSEARCH2_TESTMODE¶
Set this to True to make ElasticSearch behave in a manner that makes writing Unit tests a bit easier.
Add the following to you test settings to enable testmode:
IEVV_ELASTICSEARCH2_TESTMODE = True
ievv_batchframework¶
IEVV_BATCHFRAMEWORK_ALWAYS_SYNCRONOUS¶
If this is True
, all actions will be executed syncronously. Read more about
this in ievv_batchframework_develop_asyncronous.
ievv_sms¶
IEVV_SMS_DEFAULT_BACKEND_ID¶
The default backend ID to use for SMS sending. Example:
IEVV_SMS_DEFAULT_BACKEND_ID = 'debugprint'
utils¶
IEVV_SLUGIFY_CHARACTER_REPLACE_MAP¶
Custom character replacement map for the ievv_slugify
function
IEVV_COLORIZE_USE_COLORS¶
Colorize output from ievv_opensource.utils.ievv_colorize.colorize()
? Defaults
to True
.
IEVV_VALID_REDIRECT_URL_REGEX¶
Valid redirect URLs for utils.validate_redirect_url — Validate redirect urls.
Defaults to ^/.*$
, which means that only urls without domain is allowed by default.
Example for only allowing redirect urls that does not contain a domain, or redirect urls within the example.com domain:
IEVV_VALID_REDIRECT_URL_REGEX = r'^(https?://example\.com/|/).*$'
Warning
Do not use ^https://example\.com.*$
(no / after the domain). This
can potentially lead to attacks using subdomains. ^https://example\.com.*$
would
allow example.com.spamdomain.io/something
, but ^https://example\.com/.*$
would
not allow this.