Settings that need to be different per game are configured in the Config
model. The model will be created automatically when the game is visited with a new subdomain, otherwise you can create it manually when creating a new site. The settings are described in the help text of the model fields.
- At least one of the settings
GAME_HARD_TIMEOUT
orGAME_SOFT_TIMEOUT
must be set, even whenGAME_END_TIME
is set. When both areNone
, the game never ends and no new game can be created on the next day.
POLLING_INTERVAL
how often to poll for new votes.POLLING_INTERVAL_SSE
how often to poll for new votes, when server-sent events are used.0
disables polling, when server-sent events are used.
- You may want to set
POLLING_INTERVAL_SSE
to a smaller (but bigger than 0) value thanuser active timeout
in theConfig
model, to mark users as active, who still have their boards open, but did not vote foruser active timeout
minutes.
BORDER
size of the field border in the images.H_BOX_PADDING
,V_BOX_PADDING
padding of the fields in the images.H_LINE_MARGIN
,V_LINE_MARGIN
margin of the text in the images. Needed to render multiline text nicely.COLOR_FROM
,COLOR_TO
two integer values. the RGB-values of the randomly generated color for marking fields will be chosen from this range.NEUTRAL_FIELD_COLOR
background color of neutral fieldsNEUTRAL_WORD_COLOR
word color of neutral fieldsMIDDLE_FIELD_COLOR
background color of middle fieldsMIDDLE_WORD_COLOR
word color of middle fields- no
MARKED_FIELD_COLOR
, because its chosen randomly fromCOLOR_FROM
toCOLOR_TO
MARKED_WORD_COLOR
word color of marked fields- no
VOTED_FIELD_COLOR
, because its chosen randomly fromCOLOR_FROM
toCOLOR_TO
VOTES_WORD_COLOR
word color of neutral fieldsVETO_FIELD_COLOR
background color of veto fieldsVETO_WORD_COLOR
word color of veto fieldsFONT_SIZE
the font size in the images.BINGO_IMAGE_DATETIME_FORMAT
format for the datetime in the board images
THUMBNAIL_CACHE_EXPIRY
time a board thumbnail is cached (seconds).OLD_THUMBNAIL_CACHE_EXPIRY
time a board thumbnail from an old game is cached (seconds).THUMBNAIL_WIDTH
/THUMBNAIL_HEIGHT
maximum width/height of the thumbnails.
With server-sent events, the game needs less polling for vote numbers and the numbers are displayed almost instantly. You need a Redis database and you have to run a second process to deliver the events.
Configuration:
- install python modules
sse
,flask
,redis
andgevent
. - deploy bin/django-bingo-serversent.py somewhere. you can set the
SITE_ID
of your bingo instance via the environment variableSITE_ID
. You need to use some async server, such asgunicorn
withgevent
workers.- At the moment you need to edit the script to change the redis server address. Depending on your deployment you may need to change the
@application.route("/")
to the path in your url as well.
- At the moment you need to edit the script to change the redis server address. Depending on your deployment you may need to change the
- set
USE_SSE
toTrue
- set
SSE_URL
to the url, where the server can be reached. REDIS_HOST
andREDIS_PORT
can be used to specify the address of your redis instance for the django app.
THEME
relative or absolute URL to a theme. When the string does not start with "/", "http://" or "https://", the string is interpreted as a static files path. (Default: None)THEMES
A list of themes, which will be available via a theme chooser. Example:THEMES = (('dark', 'bingo/themes/dark.css'), ('some other theme', 'http://mysite/mytheme.css'))
(Default: a "dark" theme.None
will disable the theme chooser)
CACHE
You need to increase'OPTIONS': {'MAX_ENTRIES': XXXXX}
to cache enough entries. The cached entries can quickly add up to a large number of keys, while the stored data is rather small, and having too little cache will rapidly increase the number of database queries. You need at least:- word cache: 1 entry per board currently viewed by users or visible on the front page.
- thumbnail cache: 1 entry per thumbnail visible on the front page or viewed on game pages.
- vote cache: 2 entries per game currently viewed by users or visible on front page.
- game_expired: 1 entry per game.
- Note:* the "visible on the front page" is only relevant, when thumbnails are enabled.
- Example: 50 words, 10 games visible, each with 10 boards: 100 + 100 + 2*100 + 10 = 410 entries.