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.
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-specific files are under the frontend/
subdirectory, run commands inside that subdirectory.
To build and run the frontend single-page-app, you'll need:
-
Node v10.1.0 and up.
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
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