What is the best way to implement django with keen?
Hello I've started to use Keen to create our web pages through django and was wondering what is the best practice to implement keen v3 themes within our django stack. Is it by in doing the fat client way of having api calls that is made to retrieve the django data which then will be used to populate a keen table for example, or is it to implement that data extraction directly into the templates? I saw that there was a 'Coming Soon' tab around Django, but wondering if you can provide insight around this so that I can implement it within the django stack with the best practice. Thank you so much. Also if it's possible to directly get in touch with keen support that would be awesome to help me develop keen django!
Hi Jerome Rufin,
You can use the HTML version to integrate it into your existing Django project.
You can go to the index.html template and check the CSS and js included in the template head and foot. Once you fully understand what are CSS and js files to include in each page of your application the rest will be quite easy.
2. You can use the layout builder to prepare your HTML template. For example, if you are using the demo1 you can go to the online preview of the demo:
The layout builder helps you to configure the layout with available options and preview it in real time. Once you decide what configuration you like to use you can download the HTML code of your preferred configuration. To do so go to the bottom of the page and find the "Export" button and you will get a package containing the HTML template with the partials(header, aside, footer, etc) that can be used for your server-side integration. The export package provides you with only the HTML code with structured includable partials that are perfect for server-side integration. The assets can be included in your local download version.
3. Once you integrated the master layout and all the menus and navigation you can proceed with your inner pages by referring to the original theme demos.
4. Also as the primary reference to the available features, you can refer to the demo pages' source code for each feature.
If you need any further help, please let us know.
Sorry if I wasn't clear - I'm mainly asking after adding in these html's if I wanted to populate these pages with dynamic data what would be the best way to go about doing that ? Or I guess what is the best practice?
Say I wanted to populate some table with subscription data coming from our django models for example. What would be best practice here:
1. either implement it all together -> basically with something like django tagging (for loops within the html code)
2. have endpoints that the pages would be calling (basically separating front end and backend)
Hi Jerome Rufin.
I would say this is highly depending on the nature of your project AND your way of doing front-end.
If it's a standard CRUD app, I would highly suggest you to go option 1(Django + HTMX)
If it's an app that needs a lots of interactivity just go option 2(Django + DRF + React), bu remember with FE framework you will add a layer of complexity.
The best practices is is all depend on you project nature.
Ask yourself, what the users are expecting really from your app , They lean on (Content or interectivity).
NB : Just to let you know that I personnaly wen option 1, even if we are developping an middle project related to Healthcare field, but we did embrace htmx + hyperscript coupling it with Django as a backend, because we wouldn't miss all the batteries included of what django offers out of the box (Authentification, Sessions, Forms, Templating, i18n, Localisation, ...etc), but instead of alll of that if you go option 2, you have to find a way to do all of that in your Front-end by yourself as you use django just as a Json producer (Backend).
Hope it helps.