django-webpack-loader problem

2019-03-04 Thread Tom Zhang
Hi, all,

Hi, did anyone used this library before?

https://github.com/owais/django-webpack-loader

In my html, I put {% load render_bundle from webpack_loader %} in the
html, then I have {% render_bundle 'main' 'js' %}. However, django
says SyntaxError('invalid syntax', ('', 1, 2, "{%
render_bundle 'main.js' %}"))

This is the new error info:

WebpackBundleLookupError at /chem_ocr/rxn
Cannot resolve bundle main.
Request Method: GET
Request URL: http://localhost:8000/chem_ocr/rxn
Django Version: 2.1.5
Exception Type: WebpackBundleLookupError
Exception Value:
Cannot resolve bundle main.
Exception Location:
/var/www/ocr/venv/lib/python3.6/site-packages/webpack_loader/loader.py
in get_bundle, line 83
Python Executable: /var/www/ocr/venv/bin/python3
Python Version: 3.6.7
Python Path:
['/var/www/ocr/ocr',
 '/home/think/.vscode/extensions/ms-python.python-2019.2.5433/pythonFiles',
 '/usr/lib/python36.zip',
 '/usr/lib/python3.6',
 '/usr/lib/python3.6/lib-dynload',
 '/var/www/ocr/venv/lib/python3.6/site-packages']
Server time: Mon, 4 Mar 2019 07:32:14 +



Does anyone know why? Thanks

Tom

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/CAF35gg1M1B9QuSNK%3DRtyvFd6ZCxYzbtcwPds4JfRGWb90n4k%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django template

2019-02-08 Thread Tom Zhang
Thanks. I know how to do this according to Django way. But if you use 
Django's way to transfer data, it makes it difficult to move to other 
frameworks, right? What do you think?

On Saturday, February 9, 2019 at 1:42:19 AM UTC-5, Mikko wrote:
>
> Hi,
>
> You can connect your backend to frontend using views.py file. In views.py 
> you can get and sort your data from SQL and send it to your html. 
>
> You probably should do tutorial or watch youtube videos (as I did since I 
> get bored in reading very fast) to learn more. CodingEntrepreneur has done 
> quite up to date videos, though you might need to check some point from 
> tutorial sheets as well.
> Here is a link to backend-frontend video, but better to see the series 
> from the beginning when you are new:
>
>
> https://www.youtube.com/watch?v=h05UEays2KI=PLEsfXFp6DpzTD1BD1aWNxS2Ep06vIkaeW=17
>
> My example from views.py, where I get and sort data from my database and 
> connect it to my webpage. In your html you need some code to get the data 
> from views.py.
>
> *views.py*
>
> from django.shortcuts import render
> from .models import news 
>
> def Home(request):
> worlddata = 
> news.objects.filter(subsection__exact='World').order_by('-created')[:8]
> args = {'worlddata': worlddata}
> return render(request, "news/home.html", args)
>
> In* home.html* (bolded ones is the code you need to connect to your 
> views.py)
>
> *{% for news in worlddata %}*
>  *{{ news.title }}* 
> 
> *{% endfor %}*
>
> -Mikko
>
>
> la 9. helmik. 2019 klo 8.15 Tom Zhang (compute...@gmail.com ) 
> kirjoitti:
>
>> Thanks. But if I do this way, how do I transfer data between back-end and 
>> front-end? Do I use post request?
>>
>>
>> On Friday, February 8, 2019 at 8:35:28 PM UTC-5, Nitin Kalmaste wrote:
>>>
>>> You are correct,
>>> You are using HTML and JavaScript as template in django. You need to 
>>> store static files like css/images/JavaScript in static folder and 
>>> configure static folder in the settings file
>>>
>>> On Sat, Feb 9, 2019, 1:00 AM Mikko Meronen >>
>>>> Hi,
>>>>
>>>> Have to say that Im still beginner in Django and coding, but I think 
>>>> you just create you html files to your templates folder, and in the end 
>>>> you 
>>>> are basically using just html. Django can just find your html file from 
>>>> templates folder.
>>>>
>>>> Im just learning javascript and I assume i can save my js-file to 
>>>> templates folder as well and connect it to my html.
>>>>
>>>> -Mikko
>>>>
>>>> pe 8.2.2019 klo 21.07 Tom Zhang  kirjoitti:
>>>>
>>>>> Hi, all,
>>>>>
>>>>> If I don't want to use Django template engine and I just want to use 
>>>>> regular html/javacript, how do I configure settings.py?
>>>>> I am thinking about the portability issue. For example, if I want to 
>>>>> move away from django in the future, I hope my templates can still be 
>>>>> used 
>>>>> in other frameworks, at least, with minimum changes.
>>>>> My settings are:
>>>>>
>>>>> TEMPLATES = [
>>>>> {
>>>>> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>>>>> 'DIRS': [os.path.join(BASE_DIR, 'templates')],
>>>>> 'APP_DIRS': True,
>>>>> 'OPTIONS': {
>>>>> 'context_processors': [
>>>>> 'django.template.context_processors.debug',
>>>>> 'django.template.context_processors.request',
>>>>> 'django.contrib.auth.context_processors.auth',
>>>>> 'django.contrib.messages.context_processors.messages',
>>>>> ],
>>>>> },
>>>>> },
>>>>> ]
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Tom
>>>>>
>>>>> -- 
>>>>> 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.
>>&g

Re: Django template

2019-02-08 Thread Tom Zhang
Thanks. But if I do this way, how do I transfer data between back-end and 
front-end? Do I use post request?


On Friday, February 8, 2019 at 8:35:28 PM UTC-5, Nitin Kalmaste wrote:
>
> You are correct,
> You are using HTML and JavaScript as template in django. You need to store 
> static files like css/images/JavaScript in static folder and configure 
> static folder in the settings file
>
> On Sat, Feb 9, 2019, 1:00 AM Mikko Meronen   wrote:
>
>> Hi,
>>
>> Have to say that Im still beginner in Django and coding, but I think you 
>> just create you html files to your templates folder, and in the end you are 
>> basically using just html. Django can just find your html file from 
>> templates folder.
>>
>> Im just learning javascript and I assume i can save my js-file to 
>> templates folder as well and connect it to my html.
>>
>> -Mikko
>>
>> pe 8.2.2019 klo 21.07 Tom Zhang > 
>> kirjoitti:
>>
>>> Hi, all,
>>>
>>> If I don't want to use Django template engine and I just want to use 
>>> regular html/javacript, how do I configure settings.py?
>>> I am thinking about the portability issue. For example, if I want to 
>>> move away from django in the future, I hope my templates can still be used 
>>> in other frameworks, at least, with minimum changes.
>>> My settings are:
>>>
>>> TEMPLATES = [
>>> {
>>> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>>> 'DIRS': [os.path.join(BASE_DIR, 'templates')],
>>> 'APP_DIRS': True,
>>> 'OPTIONS': {
>>> 'context_processors': [
>>> 'django.template.context_processors.debug',
>>> 'django.template.context_processors.request',
>>> 'django.contrib.auth.context_processors.auth',
>>> 'django.contrib.messages.context_processors.messages',
>>> ],
>>> },
>>> },
>>> ]
>>>
>>> Thanks,
>>>
>>> Tom
>>>
>>> -- 
>>> 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/237d37a9-a913-430c-8861-eeedb8f6bece%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/237d37a9-a913-430c-8861-eeedb8f6bece%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> 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/CAGD0jjJju_32dqxzuz56z1EUqPnGirQFMFgn0RPOP_qWEGznPA%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/django-users/CAGD0jjJju_32dqxzuz56z1EUqPnGirQFMFgn0RPOP_qWEGznPA%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>> 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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/14ac6d90-7e51-45dc-9a15-7a5938a6a471%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django template

2019-02-08 Thread Tom Zhang
I will give it a try first. Thanks

On Friday, February 8, 2019 at 2:30:39 PM UTC-5, Mikko wrote:
>
> Hi,
>
> Have to say that Im still beginner in Django and coding, but I think you 
> just create you html files to your templates folder, and in the end you are 
> basically using just html. Django can just find your html file from 
> templates folder.
>
> Im just learning javascript and I assume i can save my js-file to 
> templates folder as well and connect it to my html.
>
> -Mikko
>
> pe 8.2.2019 klo 21.07 Tom Zhang > 
> kirjoitti:
>
>> Hi, all,
>>
>> If I don't want to use Django template engine and I just want to use 
>> regular html/javacript, how do I configure settings.py?
>> I am thinking about the portability issue. For example, if I want to move 
>> away from django in the future, I hope my templates can still be used in 
>> other frameworks, at least, with minimum changes.
>> My settings are:
>>
>> TEMPLATES = [
>> {
>> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>> 'DIRS': [os.path.join(BASE_DIR, 'templates')],
>> 'APP_DIRS': True,
>> 'OPTIONS': {
>> 'context_processors': [
>> 'django.template.context_processors.debug',
>> 'django.template.context_processors.request',
>> 'django.contrib.auth.context_processors.auth',
>> 'django.contrib.messages.context_processors.messages',
>> ],
>> },
>> },
>> ]
>>
>> Thanks,
>>
>> Tom
>>
>> -- 
>> 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/237d37a9-a913-430c-8861-eeedb8f6bece%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/237d37a9-a913-430c-8861-eeedb8f6bece%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> 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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/493fdb29-83cd-46ea-bde9-cc27d6cecd90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django template

2019-02-08 Thread Tom Zhang
Hi, all,

If I don't want to use Django template engine and I just want to use 
regular html/javacript, how do I configure settings.py?
I am thinking about the portability issue. For example, if I want to move 
away from django in the future, I hope my templates can still be used in 
other frameworks, at least, with minimum changes.
My settings are:

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

Thanks,

Tom

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/237d37a9-a913-430c-8861-eeedb8f6bece%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django template

2019-02-08 Thread Tom Zhang
Hi,

If I don't want to use any Django template and I just want to use regular 
html/javascript, how should I setup the template config in settings.py?

Right now, my settings are:

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

Thanks,

Tom

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/e88d65e8-c992-4a57-ac5b-3ed5f60dab24%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.