diff --git a/settings/common.py b/settings/common.py index 544758d3..7e0cfd3c 100644 --- a/settings/common.py +++ b/settings/common.py @@ -193,9 +193,6 @@ MESSAGE_STORAGE = "django.contrib.messages.storage.session.SessionStorage" # urls depends on it. On production should be set # something like https://media.taiga.io/ MEDIA_URL = "http://localhost:8000/media/" - -# Static url is not widelly used by taiga (only -# if admin is activated). STATIC_URL = "http://localhost:8000/static/" # Static configuration. diff --git a/taiga/mdrender/extensions/emojify.py b/taiga/mdrender/extensions/emojify.py index cdf986ef..020ba329 100644 --- a/taiga/mdrender/extensions/emojify.py +++ b/taiga/mdrender/extensions/emojify.py @@ -27,7 +27,8 @@ import re -from django.conf import settings +from django.templatetags.static import static + from markdown.extensions import Extension from markdown.preprocessors import Preprocessor @@ -35,8 +36,8 @@ from markdown.preprocessors import Preprocessor # Grab the emojis (+800) here: https://github.com/arvida/emoji-cheat-sheet.com # This **crazy long** list was generated by walking through the emojis.png -emojis_path = "{}://{}/static/img/emojis/".format(settings.SITES["api"]["scheme"], settings.SITES["api"]["domain"]) -emojis_set = { +EMOJIS_PATH = "img/emojis/" +EMOJIS_SET = { "+1", "-1", "100", "1234", "8ball", "a", "ab", "abc", "abcd", "accept", "aerial_tramway", "airplane", "alarm_clock", "alien", "ambulance", "anchor", "angel", "anger", "angry", "anguished", "ant", "apple", "aquarius", "aries", "arrows_clockwise", "arrows_counterclockwise", "arrow_backward", "arrow_double_down", @@ -168,11 +169,11 @@ class EmojifyPreprocessor(Preprocessor): def emojify(match): emoji = match.group(1) - if emoji not in emojis_set: + if emoji not in EMOJIS_SET: return match.group(0) - url = emojis_path + emoji + u'.png' - + path = "{}{}.png".format(EMOJIS_PATH, emoji) + url = static(path) return '![{emoji}]({url})'.format(emoji=emoji, url=url) for line in lines: