How to connect django and React js but getting Error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

How to connect django and React js but getting Error

Vineeth
I am using django 3.1 version how to connect django and react  i am trying to connect but 
getting Error like TemplateDoesNotExist at /index.html  i attached my folder structure and error image

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/09f5e196-12b7-44f0-a7fd-52dd8ce035cdn%40googlegroups.com.

Templates DIRS.PNG (123K) Download Attachment
Error.PNG (150K) Download Attachment
Static folder structure.PNG (98K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to connect django and React js but getting Error

Farai M
Why don't you use django rest framework API then separate your front end to your back end.That why you will not have to deal with integration issues

On Mon, Oct 26, 2020, 11:55 AM Vineeth <[hidden email]> wrote:
I am using django 3.1 version how to connect django and react  i am trying to connect but 
getting Error like TemplateDoesNotExist at /index.html  i attached my folder structure and error image

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/09f5e196-12b7-44f0-a7fd-52dd8ce035cdn%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMeub5O3jmRn%3DEgk7auSHcuLPKt0Uyv6Lp9cSkK7_ufbn8VgBA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

RES: How to connect django and React js but getting Error

Samuel Nogueira
In reply to this post by Vineeth

Please can you show me your views.py?

 

-----------------------------------------------------------------------------------------------------

Samuel Nogueira Bacelar

 

GitHub: https://github.com/SamuelNoB

 

Linkedin: https://www.linkedin.com/in/samuel-nogueira-87800b1aa/

 

-----------------------------------------------------------------------------------------------------

 

De: [hidden email]
Enviado:segunda-feira, 26 de outubro de 2020 06:54
Para: [hidden email]
Assunto: How to connect django and React js but getting Error

 

I am using django 3.1 version how to connect django and react  i am trying to connect but 

getting Error like TemplateDoesNotExist at /index.html  i attached my folder structure and error image

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/09f5e196-12b7-44f0-a7fd-52dd8ce035cdn%40googlegroups.com.

 

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6B703D92-F4D2-409F-B6B7-1303FDF9FB8F%40hxcore.ol.
Reply | Threaded
Open this post in threaded view
|

RES: How to connect django and React js but getting Error

Samuel Nogueira
In reply to this post by Farai M

Also you should follow Farai’s recommendation and use DRF in your applicaiton.

 

-----------------------------------------------------------------------------------------------------

Samuel Nogueira Bacelar

 

GitHub: https://github.com/SamuelNoB

 

Linkedin: https://www.linkedin.com/in/samuel-nogueira-87800b1aa/

 

-----------------------------------------------------------------------------------------------------

 

De: [hidden email]
Enviado:segunda-feira, 26 de outubro de 2020 06:59
Para: [hidden email]
Assunto: Re: How to connect django and React js but getting Error

 

Why don't you use django rest framework API then separate your front end to your back end.That why you will not have to deal with integration issues

 

On Mon, Oct 26, 2020, 11:55 AM Vineeth <[hidden email]> wrote:

I am using django 3.1 version how to connect django and react  i am trying to connect but 

getting Error like TemplateDoesNotExist at /index.html  i attached my folder structure and error image

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/09f5e196-12b7-44f0-a7fd-52dd8ce035cdn%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMeub5O3jmRn%3DEgk7auSHcuLPKt0Uyv6Lp9cSkK7_ufbn8VgBA%40mail.gmail.com.

 

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0A18659F-4FDD-445F-A25E-0BFD7DBC3F79%40hxcore.ol.
Reply | Threaded
Open this post in threaded view
|

Re: How to connect django and React js but getting Error

Ayser shuhaib
In reply to this post by Samuel Nogueira
Your view must return a Jason response and not render a html file.

You should learn Django Rest Framework for that
This is an example here for how your view will look like:
API View


On Mon, 26 Oct 2020 at 13:08, Samuel Nogueira <[hidden email]> wrote:

Please can you show me your views.py?

 

-----------------------------------------------------------------------------------------------------

Samuel Nogueira Bacelar

 

GitHub: https://github.com/SamuelNoB

 

Linkedin: https://www.linkedin.com/in/samuel-nogueira-87800b1aa/

 

-----------------------------------------------------------------------------------------------------

 

De: [hidden email]
Enviado:segunda-feira, 26 de outubro de 2020 06:54
Para: [hidden email]
Assunto: How to connect django and React js but getting Error

 

I am using django 3.1 version how to connect django and react  i am trying to connect but 

getting Error like TemplateDoesNotExist at /index.html  i attached my folder structure and error image

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/09f5e196-12b7-44f0-a7fd-52dd8ce035cdn%40googlegroups.com.

 

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6B703D92-F4D2-409F-B6B7-1303FDF9FB8F%40hxcore.ol.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAE0AZGKWmD87dLHepmPDEK3LgDb8Sv%3DLA2G-nNo9sdRpGOAZjA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to connect django and React js but getting Error

Omkar Parab
In reply to this post by Vineeth
In Trmplates 👇
os.path.join(BASE_DIR, 'new/build')

At the bottom 👇
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'new/build/static')    
]

On Mon, Oct 26, 2020, 3:24 PM Vineeth <[hidden email]> wrote:
I am using django 3.1 version how to connect django and react  i am trying to connect but 
getting Error like TemplateDoesNotExist at /index.html  i attached my folder structure and error image

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/09f5e196-12b7-44f0-a7fd-52dd8ce035cdn%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJY8mfzO_rnx_2LyG7R2r_U-eSaUsXyRQGXNPYMy%3D7H%2Bo%3DA%2BpA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: RES: How to connect django and React js but getting Error

David Nugent
In reply to this post by Samuel Nogueira
In this situation, something you might also consider is FastAPI https://fastapi.tiangolo.com (which is based on Starlette https://www.starlette.io).

For the database you'll probably need to use SqlAlchemy vs Django ORM, but if you're serving static content and just need to provide an API it is definitely a leaner and more performant approach for supporting frontend applications.

If you are using templates at all, then there's either FastAPI+Jinja2, or Django+DRF as recommended by others.

I've had this choice a couple of times, and while sqlalchemy is ok, I always miss having Django's ORM which does a lot of work auto-magically - sqlalchemy being somewhat more explicit. FastAPI is pretty cool though, especially having redoc/openapi support out of the box with no additional requirements.

If you stay with Django, note that you aren't actually required to use DRF and have to tackle yet another complex framework. Most of the class based views assume HTMLResponse, but if you avoid using those - and TemplateView and subclasses in particular - you can explicitly return JsonResponse in your views instead.


On 26 Oct 2020, at 22:11, Samuel Nogueira <[hidden email]> wrote:

Also you should follow Farai’s recommendation and use DRF in your applicaiton.
 
-----------------------------------------------------------------------------------------------------
Samuel Nogueira Bacelar
 
 
 
-----------------------------------------------------------------------------------------------------
 
De: [hidden email]
Enviado:segunda-feira, 26 de outubro de 2020 06:59
Para: [hidden email]
Assunto: Re: How to connect django and React js but getting Error
 
Why don't you use django rest framework API then separate your front end to your back end.That why you will not have to deal with integration issues
 
On Mon, Oct 26, 2020, 11:55 AM Vineeth <[hidden email]> wrote:
I am using django 3.1 version how to connect django and react  i am trying to connect but 
getting Error like TemplateDoesNotExist at /index.html  i attached my folder structure and error image
-- 
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/09f5e196-12b7-44f0-a7fd-52dd8ce035cdn%40googlegroups.com.
-- 
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMeub5O3jmRn%3DEgk7auSHcuLPKt0Uyv6Lp9cSkK7_ufbn8VgBA%40mail.gmail.com.
 

-- 
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0A18659F-4FDD-445F-A25E-0BFD7DBC3F79%40hxcore.ol.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/30318709-6676-4A63-8BAA-143744CB5C0F%40uniquode.io.
Reply | Threaded
Open this post in threaded view
|

Re: How to connect django and React js but getting Error

Алмаз Есеньязов
In reply to this post by Vineeth
You need to write
BASE_DIR / 'build'
not
'/build/' 

пн, 26 окт. 2020 г., 15:55 Vineeth <[hidden email]>:
I am using django 3.1 version how to connect django and react  i am trying to connect but 
getting Error like TemplateDoesNotExist at /index.html  i attached my folder structure and error image

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/09f5e196-12b7-44f0-a7fd-52dd8ce035cdn%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMjq-Bz_BLEaC%2BGWoQE9fk4KySy2aGf8jXBCsrQvE%3DXy3XXXtQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to connect django and React js but getting Error

Ravi G
Hi,

How to move source code to production if code consists of images
If anyone has any document related to  production . please share me

On Tue, Oct 27, 2020 at 6:57 PM Алмаз Есеньязов <[hidden email]> wrote:
You need to write
BASE_DIR / 'build'
not
'/build/' 

пн, 26 окт. 2020 г., 15:55 Vineeth <[hidden email]>:
I am using django 3.1 version how to connect django and react  i am trying to connect but 
getting Error like TemplateDoesNotExist at /index.html  i attached my folder structure and error image

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/09f5e196-12b7-44f0-a7fd-52dd8ce035cdn%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMjq-Bz_BLEaC%2BGWoQE9fk4KySy2aGf8jXBCsrQvE%3DXy3XXXtQ%40mail.gmail.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAr-_%2BX3_ftm1JFCoxREmj7FcpdV825mHAkhACz3cxFcNFNLXg%40mail.gmail.com.