wagtail-birdsong icon indicating copy to clipboard operation
wagtail-birdsong copied to clipboard

Birdsong without Nodejs dependency

Open OBKF opened this issue 2 years ago • 5 comments

I really love this plugin, It worked well on my development machine, but when I deployed it on my cpanel shared hosting it failed because their Python apps don't have access to Nodejs.

Is it possible to use some other implementation of mjml like this pure python one? Or maybe use a binary executable of the mjml package (I don't know it exists, I can't find one) instead of using Nodejs.

Thanks.

OBKF avatar Nov 15 '22 14:11 OBKF

Have you looked into running an MJML http server? You could set it up on a different server (on something like aws lambda or fly.io) and call out to it from your wagtail server

There's a bit about it in the django-mjml readme - https://github.com/liminspace/django-mjml#httpserver-mode

Adding a pure python mjml backend might be better addressed in django-mjml, looks like there's an issue about custom backends in that repo - https://github.com/liminspace/django-mjml/issues/122

seb-b avatar Nov 17 '22 03:11 seb-b

@seb-b Thanks, for now, I am implementing a simple newsletter using Django forms and stuff, while researching the links you provided.

It would be nice to have a system where you design your email in an external software, like Figma or MJML designer and upload the email files as zip and use that.

OBKF avatar Nov 17 '22 12:11 OBKF

Or maybe use a binary executable of the mjml package (I don't know it exists, I can't find one) instead of using Nodejs.

When looking for ways to avoid the use of Node in production environment, I found out you can use pkg to generate a binary of a given package. Then you just have to update the command path in the settings, and add the generated file to your repository so that it's available on your server too. Details here : https://github.com/mjmlio/mjml/issues/2450#issuecomment-1073716544

However, I personally think it's best to run your own http server, as @seb-b suggested.

raph146 avatar Dec 05 '22 16:12 raph146

Example of how to use your own mjml http server can also be found in Birdsong's own tests:

david-smejkal avatar Mar 30 '23 20:03 david-smejkal

Birdsong uses django-mjml and django-mjml has a GitHub Issue in that they discuss about using mjml-python which has no Nodejs dependency. https://github.com/liminspace/django-mjml/issues/184

Thus, one option is contribute that issue or just wait until it is done.

yhay81 avatar Mar 10 '24 02:03 yhay81