Discussion:
Django Uncaught SyntaxError: Unexpected token <
Han Joe
2018-11-10 13:36:24 UTC
Permalink
I want to use the django with vue, but there is an error"Uncaught
SyntaxError: Unexpected token <"
So I make a test. I make a index.html and a test.js.This is my directory

[image: 1.png]

The index.html and test.js are very simple.

[image: 2.png]
This is my code in settings.py

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['first-vue/dist'],
'APP_DIRS': True,
'OPTIONS': {
'context_ : [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'first-vue/dist')
]


This is my code in urls.py

from django.contrib import admin
from django.urls import path, re_path
from django.views.generic.base import TemplateView
from django.conf.urls import url
urlpatterns = [
path('admin/', admin.site.urls),
url(r'', TemplateView.as_view(template_name='index.html'))
]

When I open the http://127.0.0.1:8000/, I can see the 200

[image: 3.png]


But

[image: 4.png]

Can you help me? Thanks!
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/59b93f00-703a-4583-a2eb-d40e408b436c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jason
2018-11-10 14:14:54 UTC
Permalink
the error is in your javascript, not html.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dcfb6cb3-bd58-49df-951b-df4695ac1967%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Han Joe
2018-11-11 01:21:19 UTC
Permalink
The code just is
alert(111);

Thank you!


发送自 Windows 10 版邮件应甚

发件人: Jason
发送时闎: 2018幎11月10日 22:15
收件人: Django users
䞻题: Re: Django Uncaught SyntaxError: Unexpected token <

the error is in your javascript, not html.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dcfb6cb3-bd58-49df-951b-df4695ac1967%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5be7840f.1c69fb81.31ed4.1043%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.
Vishvajit Pathak
2018-11-10 19:39:00 UTC
Permalink
Could you also share yourjs file please ?
Post by Han Joe
I want to use the django with vue, but there is an error"Uncaught
SyntaxError: Unexpected token <"
So I make a test. I make a index.html and a test.js.This is my directory
[image: 1.png]
The index.html and test.js are very simple.
[image: 2.png]
This is my code in settings.py
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['first-vue/dist'],
'APP_DIRS': True,
'OPTIONS': {
'context_ : [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'first-vue/dist')
]
This is my code in urls.py
from django.contrib import admin
from django.urls import path, re_path
from django.views.generic.base import TemplateView
from django.conf.urls import url
urlpatterns = [
path('admin/', admin.site.urls),
url(r'', TemplateView.as_view(template_name='index.html'))
]
When I open the http://127.0.0.1:8000/, I can see the 200
[image: 3.png]
But
[image: 4.png]
Can you help me? Thanks!
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/43fc8e1c-7c8a-433d-8cc2-ccb5adc23fa5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Vishvajit Pathak
2018-11-10 19:39:25 UTC
Permalink
Please share js file
Post by Han Joe
I want to use the django with vue, but there is an error"Uncaught
SyntaxError: Unexpected token <"
So I make a test. I make a index.html and a test.js.This is my directory
[image: 1.png]
The index.html and test.js are very simple.
[image: 2.png]
This is my code in settings.py
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['first-vue/dist'],
'APP_DIRS': True,
'OPTIONS': {
'context_ : [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'first-vue/dist')
]
This is my code in urls.py
from django.contrib import admin
from django.urls import path, re_path
from django.views.generic.base import TemplateView
from django.conf.urls import url
urlpatterns = [
path('admin/', admin.site.urls),
url(r'', TemplateView.as_view(template_name='index.html'))
]
When I open the http://127.0.0.1:8000/, I can see the 200
[image: 3.png]
But
[image: 4.png]
Can you help me? Thanks!
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/96630af5-ae5d-439a-ad0d-4e403d0cefee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Han Joe
2018-11-11 01:20:11 UTC
Permalink
The code just is
alert(111);

Thank you!


发送自 Windows 10 版邮件应甚

发件人: Vishvajit Pathak
发送时闎: 2018幎11月11日 3:39
收件人: Django users
䞻题: Re: Django Uncaught SyntaxError: Unexpected token <

Please share js file

On Saturday, 10 November 2018 19:26:22 UTC+5:30, Han Joe wrote:
I  want to use the django with vue, but there is an error"Uncaught SyntaxError: Unexpected token <"
So I make a test. I make a index.html and a test.js.This is my directory


The index.html and test.js are very simple.

This is my code in settings.py
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['first-vue/dist'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_ : [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'first-vue/dist')
]

This is my code in urls.py
from django.contrib import admin
from django.urls import path, re_path
from django.views.generic.base import TemplateView
from django.conf.urls import url
urlpatterns = [
    path('admin/', admin.site.urls),
    url(r'', TemplateView.as_view(template_name='index.html'))
]
When I open the http://127.0.0.1:8000/, I can see the 200


But


Can you help me? Thanks!
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/96630af5-ae5d-439a-ad0d-4e403d0cefee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5be783cc.1c69fb81.f858d.2dfb%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.
Han Joe
2018-11-11 01:20:34 UTC
Permalink
The code just is
alert(111);

Thank you!


发送自 Windows 10 版邮件应甚

发件人: Vishvajit Pathak
发送时闎: 2018幎11月11日 3:39
收件人: Django users
䞻题: Re: Django Uncaught SyntaxError: Unexpected token <

Please share js file

On Saturday, 10 November 2018 19:26:22 UTC+5:30, Han Joe wrote:
I  want to use the django with vue, but there is an error"Uncaught SyntaxError: Unexpected token <"
So I make a test. I make a index.html and a test.js.This is my directory


The index.html and test.js are very simple.

This is my code in settings.py
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['first-vue/dist'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_ : [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'first-vue/dist')
]

This is my code in urls.py
from django.contrib import admin
from django.urls import path, re_path
from django.views.generic.base import TemplateView
from django.conf.urls import url
urlpatterns = [
    path('admin/', admin.site.urls),
    url(r'', TemplateView.as_view(template_name='index.html'))
]
When I open the http://127.0.0.1:8000/, I can see the 200


But


Can you help me? Thanks!
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/96630af5-ae5d-439a-ad0d-4e403d0cefee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5be783e2.1c69fb81.fd19a.f781%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.
Han Joe
2018-11-11 01:26:11 UTC
Permalink
圚 2018幎11月10日星期六 UTC+8䞋午9:56:22Han Joe写道
Post by Han Joe
I want to use the django with vue, but there is an error"Uncaught
SyntaxError: Unexpected token <"
So I make a test. I make a index.html and a test.js.This is my directory
[image: 1.png]
The index.html and test.js are very simple.
[image: 1.png]
Post by Han Joe
This is my code in settings.py
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['first-vue/dist'],
'APP_DIRS': True,
'OPTIONS': {
'context_ : [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'first-vue/dist')
]
This is my code in urls.py
from django.contrib import admin
from django.urls import path, re_path
from django.views.generic.base import TemplateView
from django.conf.urls import url
urlpatterns = [
path('admin/', admin.site.urls),
url(r'', TemplateView.as_view(template_name='index.html'))
]
When I open the http://127.0.0.1:8000/, I can see the 200
[image: 3.png]
But
[image: 4.png]
Can you help me? Thanks!
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/04038cb1-25c1-41b9-86e9-7e8f387d9a94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...