Starting a Django and VueJS Project painlessly with Webpack support.



Imagine you need to setup a project with Django, and you need to create an API endpoint that serves your frontend application, say VueJS, with resources.

Setting this up might be a little headache, especially when we'll like to maintain webpack as our module bundle.

I've found alot of hacks on the web around this but I'll be discussing a way use Webpack transparently with Django with hot reloading Vue components.

This requires implementing the following:





I forked a repo on github (see here), added a more detailed guide to it and improved on it with support the following:
  • VueJS v2
  • Vue-Axios 
  • Django CORS

And now, starting a Django and VueJS Project is as easy as running:

django-admin startproject projectname --template https://github.com/timtech4u/hello-vue-django/archive/master.zip

- Replace projectname with your Project's name

Full details here: https://github.com/Timtech4u/hello-vue-django


You can plug in whatever Rest API framework of your choice and also choose from the available list of Vuejs UI frameworks available.

Comments

Popular Posts