CleitonDeLima / django-tawkto

Tawk.to chat for django
MIT License
16 stars 2 forks source link

Error after adding {% tawkto_script %} #9

Closed lekhakmukesh closed 2 years ago

lekhakmukesh commented 3 years ago

Got this issue when adding {% tawkto_script %} on the body of the page

`Environment:

Request Method: GET Request URL: http://127.0.0.1:8000/userDashboard

Django Version: 3.2 Python Version: 3.8.2 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'blogs', 'ckeditor', 'tawkto'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Template error: In template /Users/technosanta/PycharmProjects/riverSweepWeb/templates/base_user_dashboard.html, error at line 77 Invalid block tag on line 77: 'tawkto_script'. Did you forget to register or load this tag? 67 : {#var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();#} 68 : {#(function(){#} 69 : {#var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];#} 70 : {#s1.async=true;#} 71 : {#s1.src='https://embed.tawk.to/60927d21185beb22b30a3a58/1f4u3hj35';#} 72 : {#s1.charset='UTF-8';#} 73 : {#s1.setAttribute('crossorigin','*');#} 74 : {#s0.parentNode.insertBefore(s1,s0);#} 75 : {#})();#} 76 : {##} 77 : {% tawkto_script %} 78 : 79 : 80 : {% include 'footer/footer.html' %} 81 : 82 : 83 : 84 : 85 : 86 :

Traceback (most recent call last): File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/template/base.py", line 470, in parse compile_func = self.tags[command]

During handling of the above exception ('tawkto_script'), another exception occurred: File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/core/handlers/base.py", line 181, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/Users/technosanta/PycharmProjects/riverSweepWeb/blogs/views.py", line 47, in userDashboardView return render(request, template) File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/shortcuts.py", line 19, in render content = loader.render_to_string(template_name, context, request, using=using) File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/template/loader.py", line 62, in render_to_string return template.render(context, request) File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/template/backends/django.py", line 61, in render return self.template.render(context) File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/template/base.py", line 170, in render return self._render(context) File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/template/base.py", line 162, in _render return self.nodelist.render(context) File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/template/base.py", line 938, in render bit = node.render_annotated(context) File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/template/base.py", line 905, in render_annotated return self.render(context) File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/template/loader_tags.py", line 127, in render compiled_parent = self.get_parent(context) File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/template/loader_tags.py", line 124, in get_parent return self.find_template(parent, context) File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/template/loader_tags.py", line 103, in find_template template, origin = context.template.engine.find_template( File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/template/engine.py", line 125, in find_template template = loader.get_template(name, skip=skip) File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/template/loaders/base.py", line 29, in get_template return Template( File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/template/base.py", line 155, in init self.nodelist = self.compile_nodelist() File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/template/base.py", line 193, in compile_nodelist return parser.parse() File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/template/base.py", line 472, in parse self.invalid_block_tag(token, command, parse_until) File "/Users/technosanta/Library/Python/3.8/lib/python/site-packages/django/template/base.py", line 531, in invalid_block_tag raise self.error(

Exception Type: TemplateSyntaxError at /userDashboard Exception Value: Invalid block tag on line 77: 'tawkto_script'. Did you forget to register or load this tag?`

CleitonDeLima commented 3 years ago

@lekhakmukesh , did you load the tag?

{% load tawkto_tags %}
...
{% tawkto_script %}
lekhakmukesh commented 3 years ago

@CleitonDeLima still widget is not showing in the website. I get this message in the console

_Failed to load resource: the server responded with a status of 404 ()_

CleitonDeLima commented 3 years ago

I need more details.
What's your django version? if you can show a snippet of your code