4 ms·
Django templates + Bootstrap + jQuery is all I've ever needed to make great, modern websites. Server-side rendering with some nice layouts and interactivity on
by VWWHFSfQ 5y ago
Django templates + Bootstrap + jQuery is all I've ever needed to make great, modern websites. Server-side rendering with some nice layouts and interactivity on the frontend. I've tried some of the SPA frameworks and I've always felt like my productivity tanked.
- notoriousarun 5y agoDo you develop REST API also....? The fundamental issue is that it binds the server to the client, who must understand HTML structure. It also makes it more difficult to reuse the endpoints in different ways or for new applications. Returning data and letting the client render it decreases coupling and increases flexibility/testability- you can run unit tests on the client for mock data, and run unit tests on the server to test the desire
- rubyist5eva 5y agoI don't use Django but I use Ruby on Rails, and turning a server-side rendered page into an API is trivial. Rails requests automatically understand the format of a request and let you specify what do when a specific kind of format comes in: ie. when it's an html request, render this page, when it's a "js" request, render a jbuilder template. ezpz whatever frontend framework you're using has really nothing to do with it at all.
- 1337shadow 5y agoConfirmed this is also trivial with Django, have done it to my crud, and even have a view that parses my url router for views and return an openapi definition with a swagger ui.
- notoriousarun 5y agoDo you use Django REST Framework with Web Swagger Console UI?
- 1337shadow 5y agoNope, I have a view that parses my url router for views and generates an openapi schema, and a view that shows a swagger with it.
- dec0dedab0de 5y agoIn General I agree, but using a SPA framework has one major benefit. It forces you to make an API for everything. So when a request comes in to make something more dynamic you have everything you need ready to go. Also, if you're building an app that some users need API access for, it's already there. I daydream about making a framework that lets me use django templates as a SPA that does server side rendering on the first request, or when javascript is unavailable.
- brushfoot 5y ago> using a SPA framework has one major benefit. It forces you to make an API for everything. This is a drawback unless you truly need an API. YAGNI. I've found a hybrid approach works well. Your site is mostly server side, but some individual pages have Vue and an API endpoint or two. If that mobile app or that third-party integration becomes a need, add endpoints for that particular use case. I've gone the other route and prematurely optimized for the "what ifs" first, and it's painful when they don't happen and you're left holding all that complexity.