From old-school Post/Redirect/Get to modern web (2018)

77 views
Skip to first unread message

guettli

unread,
Sep 3, 2018, 11:36:35 AM9/3/18
to Django users
I use Post/Redirect/Get since several years. I use simple HTML forms (via ModelForm) with a plain old submit-button.

Above pattern works.

But I think the web of the future works different.

Up to now my web application sends html to the web client. I think modern web applications
don't send html, they send data (in json format).

I guess in the future web clients render the (json) data using a library/framework.

For me this client-side rendering is completely new. I have no clue where to start this adventure.

I guess django-rest-framework could help on the server side....

Has anyone hints or practical experience?



Jason

unread,
Sep 3, 2018, 12:25:55 PM9/3/18
to Django users
Correct, but the basics are pretty much the same.  Think of a post request to be analogous to a form submit.  Code-wise on the server doesn't change too much, and django-rest-framework helps a great deal with that.

The difficult part is to do this client-side.  There are three primary frameworks in JS to do this: angular, react and vue, and each have a vibrant community around them and excellent documentation. However, just like with django and python, its best to know javascript before you start with a framework.

Couple things to get famiiar with:

  • API - Know how to build a REST API and the usages of the HTTP methods.  
  • API - Return correct error codes with incorrect requests, don't just tag a 200 and expect the client to parse the error message
  • JS - Get comfortable with promises and how they handle asynchronicity.  They're everywhere and you need to know them.
  • JS - ES6 makes things alot easier.  Use it, and be familiar with using babel and polyfills to extend support to older browsers that may not have the JS features you're using.

guettli

unread,
Sep 5, 2018, 7:27:25 AM9/5/18
to Django users
Hi Jason and other django users,

thank you very much for your reply.

I think this whole thing is more about feelings than about technical details.

I love Python and my team mates like it.

No one in my team loves JavaScript.

We are lazy. We are doing Python and PostgreSQL since several years and only little JS and jquery magic.

I can write a python method and a unittest to check its behaviour in seconds.

But with JS it is different. It is hard to find the matching words.

It is hard to choose between angular, react and vue, if you are not doing JS stuff daily.

I am still unsure who to get from old-school Post/Redirect/Get to modern web. But I know
we need to find a decision sooner or later.

Thank you for listening.

Regards,
  Thomas Güttler

Jason

unread,
Sep 5, 2018, 10:59:54 AM9/5/18
to Django users
Yeah, I get what you mean.  Used to work at a Java shop using Google Web Toolkit to build their web application, and it was ok.  Until you tried to do something that GWT didn't like and had to figure workarounds.  The reason GWT was picked was everyone in the company knew Java, and not JS.  That worked until the issues with GWT couldn't be papered over any longer, and they started porting parts over to Angular, which required some people to become familiar with JS.  That was on-the-job training.

Sounds like you really have two options: 
  1. Hire a competent FE dev to work with your team for the frontend and incorporate migrating your existing code to a RESTful API (with DRF, this isn't too big a deal), or
  2. Assign a volunteer (or just tell someone) to get familiar with JS and evaluate angular, vue or react for your needs and become the in-house expert.
Either way, its a significant investment in time and money because the team lacks the skills required.  But it is an important skill to have in the web dev world and you really do risk being left behind without it.

guettli

unread,
Sep 6, 2018, 7:40:36 AM9/6/18
to Django users
Up to now your customers keep us busy with new ideas. We even hardly advertise our products :-)

I was talking to a JS expert. He likes the react framework. Now there are four frameworks to evaluate ...

Regards,
  Thomas
Reply all
Reply to author
Forward
0 new messages