DJango REST API + JS Front End

54 views
Skip to first unread message

Amsa

unread,
Jun 24, 2019, 3:56:23 AM6/24/19
to Django REST framework
I am building a DJango Web Application where the back end is the DJango Rest API and the front end is HTML/JS. 

Can I Keep both the API code (DJango project) and the front end code (WWW folder) in the same server? or Should I move the front end to somewhere else like AWS?

Also, I am making the API calls through HTTP requests from JS (within the same server).  Is this the right approach.

Appreciate your help.  

Regards
Amsa

Wanderley S

unread,
Jun 24, 2019, 8:21:34 AM6/24/19
to django-res...@googlegroups.com
Hi there Amsa,

Both approaches are fine, I mean, there's no "right or wrong" since, choosing between then is more a personnal / architecture design choice.
Keep in mind that if you use Django project to deliver your frontend application as a static file, you will have to create an url pointing to a view, that will render this HTML file (your frontend app)

If distributing them separately you might have to install and configure django-cors, if requests from Javascript will come from a different domain.


Cheers,

--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/25a44b32-0f2e-402a-a561-891358f14e44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Amsa

unread,
Jun 24, 2019, 8:28:11 AM6/24/19
to Django REST framework
Fantastic.  Thanks, Wanderley.

Cheers
Amsa


On Monday, June 24, 2019 at 5:51:34 PM UTC+5:30, Wandss wrote:
Hi there Amsa,

Both approaches are fine, I mean, there's no "right or wrong" since, choosing between then is more a personnal / architecture design choice.
Keep in mind that if you use Django project to deliver your frontend application as a static file, you will have to create an url pointing to a view, that will render this HTML file (your frontend app)

If distributing them separately you might have to install and configure django-cors, if requests from Javascript will come from a different domain.


Cheers,

Em seg, 24 de jun de 2019 às 04:56, Amsa <amsala...@gmail.com> escreveu:
I am building a DJango Web Application where the back end is the DJango Rest API and the front end is HTML/JS. 

Can I Keep both the API code (DJango project) and the front end code (WWW folder) in the same server? or Should I move the front end to somewhere else like AWS?

Also, I am making the API calls through HTTP requests from JS (within the same server).  Is this the right approach.

Appreciate your help.  

Regards
Amsa

--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+unsub...@googlegroups.com.

Wanderley S

unread,
Jun 24, 2019, 8:55:58 AM6/24/19
to django-res...@googlegroups.com
You're welcome,

Tell me if you have any doubts during implementation.

Cheers,

Em seg, 24 de jun de 2019 às 09:28, Amsa <amsala...@gmail.com> escreveu:
Fantastic.  Thanks, Wanderley.

Cheers
Amsa

On Monday, June 24, 2019 at 5:51:34 PM UTC+5:30, Wandss wrote:
Hi there Amsa,

Both approaches are fine, I mean, there's no "right or wrong" since, choosing between then is more a personnal / architecture design choice.
Keep in mind that if you use Django project to deliver your frontend application as a static file, you will have to create an url pointing to a view, that will render this HTML file (your frontend app)

If distributing them separately you might have to install and configure django-cors, if requests from Javascript will come from a different domain.


Cheers,

Em seg, 24 de jun de 2019 às 04:56, Amsa <amsala...@gmail.com> escreveu:
I am building a DJango Web Application where the back end is the DJango Rest API and the front end is HTML/JS. 

Can I Keep both the API code (DJango project) and the front end code (WWW folder) in the same server? or Should I move the front end to somewhere else like AWS?

Also, I am making the API calls through HTTP requests from JS (within the same server).  Is this the right approach.

Appreciate your help.  

Regards
Amsa

--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/64a5570d-aab4-4ae3-9e8c-f20908f33f26%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages