I'm setting up comments in Wagtail using django-comments-xtd and one thing I'm having trouble figuring out is why my comment permalinks keep going to https://example.com/news/bloggy-test-post/#c1 instead of https://localhost:8000/news/bloggy-test-post/#c1.
I found a user with a similar issue in the Wagtail Google group who discovered that they had "example.com" set as their site in Wagtail admin. But I have only one site in my settings and it's currently set to "localhost" with a port of 8000.
Screenshot of the Wagtail admin site showing there is one site set to localhost with a port of 8000
I searched all my files and libraries for "example.com" and the only other setting I found was the BASE_URL setting in base.py. I tried changing that to http://localhost:8000 and the comment permalinks are still being directed to "example.com".
Is there another setting I'm missing? Or another way I'm supposed to get the URL?
Currently, I have this code for grabbing the url in my models.py file:
def get_absolute_url(self):
return self.get_url()
This is the comments section code from my template:
{% get_comment_count for page as comment_count %}
<p>
<a href="{% pageurl page %}#comments">
{{ comment_count }} comment{{ comment_count|pluralize }}
</a>
{{ comment_count|pluralize:"has,have" }} been posted.
</p>
{% render_xtdcomment_tree for page %}
{% render_comment_form for page %}
And this is (hopefully) the pertinent piece from comment_tree.html from django-comments-xtd:
<h6 class="mb-1 small d-flex">
<div class="mr-auto">{{ item.comment.submit_date }} - {% if item.comment.url and not item.comment.is_removed %}<a href="{{ item.comment.url }}" target="_new">{% endif %}{{ item.comment.name }}{% if item.comment.url %}</a>{% endif %}{% if item.comment.user and item.comment.user|has_permission:"django_comments.can_moderate" %} <span class="badge badge-secondary">{% trans "moderator" %}</span>{% endif %} <a class="permalink" title="{% trans 'comment permalink' %}" href="{% get_comment_permalink item.comment %}">¶</a></div>
<span>
{% if not item.comment.is_removed %}
{% if perms.comments.can_moderate %}
{% if item.flagged_count %}
<span class="badge badge-danger" title="{% blocktrans count counter=item.flagged_count %}A user has flagged this comment as inappropriate.{% plural %}{{ counter }} users have flagged this comment as inappropriate.{% endblocktrans %}">{{ item.flagged_count }}</span>
{% endif %}
{% endif %}
{% if allow_flagging and item.flagged %}
<i class="fas fa-flag text-danger" title="{% trans 'comment flagged' %}"></i>
{% elif allow_flagging %}
<a class="mutedlink"
href="{% url 'comments-flag' item.comment.pk %}">
<i class="fas fa-flag" title="{% trans 'flag comment' %}"></i>
</a>
{% endif %}
{% if perms.comments.can_moderate %}
<a class="mutedlink"
href="{% url 'comments-delete' item.comment.pk %}"><i class="fas fa-trash-alt" title="{% trans 'remove comment' %}"></i></a>
{% endif %}
{% endif %}
</span>
</h6>