5 ms·
> This post aims to show that you can start to use Vue with your Django projects immediately without any sophisticated setup that will take hours to complete. T
by ivan_ah 7y ago
> This post aims to show that you can start to use Vue with your Django projects immediately without any sophisticated setup that will take hours to complete. Therefore, we will use the simplest method to use Vue.js: Including it via a <script> tag.
Nice. Yeah, sometimes it's easier to get started this way without investing a day in getting webpack working...
When the time comes and you need webpack, then this package has been known to help the integration between the frontend build system (webpack) and django's static file serving functions:
https://github.com/owais/django-webpack-loader https://github.com/owais/django-webpack-loader
- PascalW 7y agoI've tried setting up django-webpack-loader but it felt very heavy handed and I didn't like how it forces you to use some non-standard manifest plugin that was pretty buggy. Instead I went with vanilla Webpack outputting files into Django `STATIC_ROOT`. That way Webpack is only concerned with producing the files and Django handles the whole file name hashing, compression etc in production. I've found this to be much, much more straightforward. I'm planning to write a post about it.
- ivan_ah 7y agoYes, please blog post this. I'm curious to see how you inject the right bundle hack name (js side) into the django template (Python side). > non-standard manifest plugin I hear you, and this feels weird to me too, but then again node-land needs to talk to Django-land somehow so writing a .json file doesn't seem all that bad way to do it ;)
- tkainrad 7y agoThanks! Yeah, I think it is important for a side project to be able to start working on the actual code as quickly as possible. It is not too much of a problem to set up all these fancy frontend tools before going into production. If it's just a weekend project, it's also fine to just include some external JS libraries directly. What I seem to get away with is using Cookiecutter Django's* simple build pipeline based on npm and gulp. It is basically set up from the moment you finish the project initialization. It even comes with live reloading. The pipeline is based on these files: https://github.com/pydanny/cookiecutter-django/blob/master/%7B%7Bcookiecutter.project_slug%7D%7D/package.json https://github.com/pydanny/cookiecutter-django/blob/master/%... https://github.com/pydanny/cookiecutter-django/blob/master/%7B%7Bcookiecutter.project_slug%7D%7D/gulpfile.js https://github.com/pydanny/cookiecutter-django/blob/master/%... * https://github.com/pydanny/cookiecutter-django https://github.com/pydanny/cookiecutter-django