This is a template for combining django+vue+webpack supporting dev and prod environments
I was searching for an example/template for combining django+vue+webpack. Althought there are many repos and posts on it, none of them covered different environments settings, multiplie pages, switching hotreload. Most of them used old vue-cli config. So I combined all that exmaples and added support for multiplie pages and .env settings.
If you know how to make it better, plase feel free to contribute.
It is supposed that you have installed:
pip install --user pipenv
)npm install -g @vue/cli
)
# Clone the repo
git clone https://github.com/rguliev/django-vue-webpack-template.git
cd django-vue-webpack-template
# Set your env
cp .env.example .env
# Install all backend dependencies
pipenv install
python manage.py makemigrations
python manage.py migrate
# Install all frontend dependencies
cd frontend
npm install
DJANGO_ENV=development
NODE_ENV=development
cd frontend && npm run serve
python manage.py runserver
DJANGO_ENV=development
NODE_ENV=production
cd frontend
npm run build
cd ../
python manage.py runserver