Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

k1-c/django-vue-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django-Vue-Template

Template for coexisting Django REST framework and Vue.js.
This is something I've prepared myself to help with development, but you are free to use this if you like it.

Instalation

To deploy the app locally, you will need to:

  • If you don't have 'pipenv', install this.

  • Install required modules

pipenv install
  • (If you use PostgreSQL) Setup Database on PostgreSQL

  • Create local_settings.py from local_settings.tpl; and modify according to SECRET_KEY and DB configuration

  • Make migration files and migrate

python manage.py makemigrations
python manage.py migrate

Then, you can check backend works with a command below, and access http://localhost:8000

python manage.py runserver

Frontend

Frontend-specific files are under the frontend/ subdirectory, run commands inside that subdirectory.

Frontend - Test/Development

To build and run the frontend single-page-app, you'll need:

  • Node v10.1.0 and up.

  • Yarn

To start the development server:

  • Install NPM dependencies:
yarn install
  • Start the dev server:
yarn serve

Your default browser will open the test site http://localhost:3000

Frontend - Production

To build static files for production, including Django static assets

  • Install NPM dependencies

  • Build SPA static files

yarn build
  • Collect Django static files under static/ (Execute in root directory)
python manage.py collectstatic