├── .gitignore
├── LICENSE
├── README.md
├── circle.yml
├── deploy-docs.sh
├── docs
├── README.md
├── SUMMARY.md
├── backend.md
├── commands.md
├── e2e.md
├── env.md
├── linter.md
├── pre-processors.md
├── prerender.md
├── proxy.md
├── static.md
├── structure.md
└── unit.md
├── meta.js
├── package.json
├── template
├── .babelrc
├── .editorconfig
├── .eslintignore
├── .eslintrc.js
├── .gitignore
├── .postcssrc.js
├── Makefile
├── README.md
├── backend
│ ├── __init__.py
│ ├── settings.py
│ ├── settingsdev.py
│ ├── templates
│ │ └── index.html
│ ├── urls.py
│ ├── views.py
│ └── wsgi.py
├── frontend
│ ├── build
│ │ ├── build.js
│ │ ├── check-versions.js
│ │ ├── logo.png
│ │ ├── utils.js
│ │ ├── vue-loader.conf.js
│ │ ├── webpack.base.conf.js
│ │ ├── webpack.dev.conf.js
│ │ ├── webpack.prod.conf.js
│ │ └── webpack.test.conf.js
│ ├── config
│ │ ├── dev.env.js
│ │ ├── index.js
│ │ ├── prod.env.js
│ │ └── test.env.js
│ ├── index.html
│ ├── src
│ │ ├── App.vue
│ │ ├── assets
│ │ │ └── logo.png
│ │ ├── components
│ │ │ └── HelloWorld.vue
│ │ ├── main.js
│ │ └── router
│ │ │ └── index.js
│ └── test
│ │ ├── e2e
│ │ ├── custom-assertions
│ │ │ └── elementCount.js
│ │ ├── nightwatch.conf.js
│ │ ├── runner.js
│ │ └── specs
│ │ │ └── test.js
│ │ └── unit
│ │ ├── .eslintrc
│ │ ├── index.js
│ │ ├── karma.conf.js
│ │ ├── setup.js
│ │ └── specs
│ │ └── HelloWorld.spec.js
├── manage.py
├── package.json
├── public
│ └── .gitkeep
├── requirements-dev.txt
├── requirements.txt
└── static
│ └── .gitkeep
└── test.sh
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .DS_Store
3 | docs/_book
4 | test/
5 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013-present, Yuxi (Evan) You
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # vue-webpack-vue-django-boilerplate
2 |
3 | > A full-featured Webpack setup with hot-reload, lint-on-save, unit testing & css extraction, setup with Vue and Django.
4 |
5 | > This template is Vue 2.0 compatible. For Vue 1.x use this command: `vue init webpack#1.0 my-project`
6 |
7 | > This template is a fork of [vuejs-templates/webpack](https://github.com/vuejs-templates/webpack). Snippets and guidance have been found from [hello-vue-django](https://github.com/rokups/hello-vue-django) and a post from [ariera](https://ariera.github.io/2017/09/26/django-webpack-vue-js-setting-up-a-new-project-that-s-easy-to-develop-and-deploy-part-1.html) blog.
8 |
9 | ## Documentation
10 |
11 | - [For this template](http://vuejs-templates.github.io/webpack): common questions specific to this template are answered and each part is described in greater detail
12 | - [For Vue 2.0](http://vuejs.org/guide/): general information about how to work with Vue, not specific to this template
13 |
14 | ## Usage
15 |
16 | This is a project template for [vue-cli](https://github.com/vuejs/vue-cli). **It is recommended to use npm 3+ for a more efficient dependency tree.**
17 |
18 | ``` bash
19 | $ npm install -g vue-cli
20 | $ vue init webpack my-project
21 | $ cd my-project
22 | $ npm install
23 | $ npm run dev
24 | ```
25 |
26 | The development server will run on port 8001 by default. If that port is already in use on your machine, the next free port will be used.
27 |
28 | ## What's Included
29 |
30 | - `npm run dev`: first-in-class development experience.
31 | - Webpack + `vue-loader` for single file Vue components.
32 | - State preserving hot-reload
33 | - State preserving compilation error overlay
34 | - Lint-on-save with ESLint
35 | - Source maps
36 |
37 | - `npm run build`: Production ready build.
38 | - JavaScript minified with [UglifyJS](https://github.com/mishoo/UglifyJS2).
39 | - HTML minified with [html-minifier](https://github.com/kangax/html-minifier).
40 | - CSS across all components extracted into a single file and minified with [cssnano](https://github.com/ben-eb/cssnano).
41 | - Static assets compiled with version hashes for efficient long-term caching, and an auto-generated production `index.html` with proper URLs to these generated assets.
42 | - Use `npm run build --report`to build with bundle size analytics.
43 |
44 | - `npm run unit`: Unit tests run in [JSDOM](https://github.com/tmpvar/jsdom) with [Jest](https://facebook.github.io/jest/), or in PhantomJS with Karma + Mocha + karma-webpack.
45 | - Supports ES2015+ in test files.
46 | - Easy mocking.
47 |
48 | - `npm run e2e`: End-to-end tests with [Nightwatch](http://nightwatchjs.org/).
49 | - Run tests in multiple browsers in parallel.
50 | - Works with one command out of the box:
51 | - Selenium and chromedriver dependencies automatically handled.
52 | - Automatically spawns the Selenium server.
53 |
54 | ### Fork It And Make Your Own
55 |
56 | You can fork this repo to create your own boilerplate, and use it with `vue-cli`:
57 |
58 | ``` bash
59 | vue init username/repo my-project
60 | ```
61 |
--------------------------------------------------------------------------------
/circle.yml:
--------------------------------------------------------------------------------
1 | machine:
2 | node:
3 | version: stable
4 |
5 | dependencies:
6 | pre:
7 | - sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list'
8 | - sudo apt-get update
9 | - sudo apt-get install google-chrome-stable
10 |
11 | test:
12 | override:
13 | - bash test.sh
14 |
--------------------------------------------------------------------------------
/deploy-docs.sh:
--------------------------------------------------------------------------------
1 | cd docs
2 | rm -rf _book
3 | gitbook build
4 | cd _book
5 | git init
6 | git add -A
7 | git commit -m 'update book'
8 | git push -f git@github.com:vuejs-templates/webpack.git master:gh-pages
9 |
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 | # Introduction
2 |
3 | This boilerplate is targeted towards large, serious projects and assumes you are somewhat familiar with Webpack and `vue-loader`. Make sure to also read [`vue-loader`'s documentation](https://vue-loader.vuejs.org/) for common workflow recipes.
4 |
5 | If you just want to try out `vue-loader` or whip out a quick prototype, use the [webpack-simple](https://github.com/vuejs-templates/webpack-simple) template instead.
6 |
7 | ## Quickstart
8 |
9 | To use this template, scaffold a project with [vue-cli](https://github.com/vuejs/vue-cli). **It is recommended to use npm 3+ for a more efficient dependency tree.**
10 |
11 | ``` bash
12 | $ npm install -g vue-cli
13 | $ vue init webpack my-project
14 | $ cd my-project
15 | $ npm install
16 | $ npm run dev
17 | ```
18 |
--------------------------------------------------------------------------------
/docs/SUMMARY.md:
--------------------------------------------------------------------------------
1 | # Summary
2 |
3 | - [Project Structure](structure.md)
4 | - [Build Commands](commands.md)
5 | - [Linter Configuration](linter.md)
6 | - [Pre-Processors](pre-processors.md)
7 | - [Handling Static Assets](static.md)
8 | - [Environment Variables](env.md)
9 | - [Integrate with Backend Framework](backend.md)
10 | - [API Proxying During Development](proxy.md)
11 | - [Unit Testing](unit.md)
12 | - [End-to-end Testing](e2e.md)
13 | - [Prerendering for SEO](prerender.md)
14 |
--------------------------------------------------------------------------------
/docs/backend.md:
--------------------------------------------------------------------------------
1 | # Integrating with Backend Framework
2 |
3 | If you are building a purely-static app (one that is deployed separately from the backend API), then you probably don't even need to edit `config/index.js`. However, if you want to integrate this template with an existing backend framework, e.g. Rails/Django/Laravel, which comes with their own project structures, you can edit `config/index.js` to directly generate front-end assets into your backend project.
4 |
5 | Let's take a look at the default `config/index.js`:
6 |
7 | ``` js
8 | // config/index.js
9 | 'use strict'
10 | const path = require('path')
11 |
12 | module.exports = {
13 | build: {
14 | index: path.resolve(__dirname, 'dist/index.html'),
15 | assetsRoot: path.resolve(__dirname, 'dist'),
16 | assetsSubDirectory: 'static',
17 | assetsPublicPath: '/',
18 | productionSourceMap: true
19 | },
20 | dev: {
21 | port: 8001,
22 | proxyTable: {}
23 | }
24 | }
25 | ```
26 |
27 | Inside the `build` section, we have the following options:
28 |
29 | ### `build.index`
30 |
31 | > Must be an absolute path on your local file system.
32 |
33 | This is where the `index.html` (with injected asset URLs) will be generated.
34 |
35 | If you are using this template with a backend-framework, you can edit `index.html` accordingly and point this path to a view file rendered by your backend app, e.g. `app/views/layouts/application.html.erb` for a Rails app, or `resources/views/index.blade.php` for a Laravel app.
36 |
37 | ### `build.assetsRoot`
38 |
39 | > Must be an absolute path on your local file system.
40 |
41 | This should point to the root directory that contains all the static assets for your app. For example, `public/` for both Rails/Laravel.
42 |
43 | ### `build.assetsSubDirectory`
44 |
45 | Nest webpack-generated assets under this directory in `build.assetsRoot`, so that they are not mixed with other files you may have in `build.assetsRoot`. For example, if `build.assetsRoot` is `/path/to/dist`, and `build.assetsSubDirectory` is `static`, then all Webpack assets will be generated in `path/to/dist/static`.
46 |
47 | This directory will be cleaned before each build, so it should only contain assets generated by the build.
48 |
49 | Files inside `static/` will be copied into this directory as-is during build. This means if you change this prefix, all your absolute URLs referencing files in `static/` will also need to be changed. See [Handling Static Assets](static.md) for more details.
50 |
51 | ### `build.assetsPublicPath`
52 |
53 | This should be the URL path where your `build.assetsRoot` will be served from over HTTP. In most cases, this will be root (`/`). Only change this if your backend framework serves static assets with a path prefix. Internally, this is passed to Webpack as `output.publicPath`.
54 |
55 | ### `build.productionSourceMap`
56 |
57 | Whether to generate source maps for production build.
58 |
59 | ### `dev.port`
60 |
61 | Specify the port for the dev server to listen to.
62 |
63 | ### `dev.proxyTable`
64 |
65 | Define proxy rules for the dev server. See [API Proxying During Development](proxy.md) for more details.
66 |
--------------------------------------------------------------------------------
/docs/commands.md:
--------------------------------------------------------------------------------
1 | # Build Commands
2 |
3 | All build commands are executed via [NPM Scripts](https://docs.npmjs.com/misc/scripts).
4 |
5 | ### `npm run dev`
6 |
7 | > Starts a Node.js local development server. See [API Proxying During Development](proxy.md) for more details.
8 |
9 | - Webpack + `vue-loader` for single file Vue components.
10 | - State preserving hot-reload
11 | - State preserving compilation error overlay
12 | - Lint-on-save with ESLint
13 | - Source maps
14 |
15 | ### `npm run build`
16 |
17 | > Build assets for production. See [Integrating with Backend Framework](backend.md) for more details.
18 |
19 | - JavaScript minified with [UglifyJS](https://github.com/mishoo/UglifyJS2).
20 | - HTML minified with [html-minifier](https://github.com/kangax/html-minifier).
21 | - CSS across all components extracted into a single file and minified with [cssnano](https://github.com/ben-eb/cssnano).
22 | - All static assets compiled with version hashes for efficient long-term caching, and a production `index.html` is auto-generated with proper URLs to these generated assets.
23 |
24 | ### `npm run unit`
25 |
26 | > Run unit tests in JSDOM with [Jest](https://facebook.github.io/jest/docs/getting-started.html). See [Unit Testing](unit.md) for more details.
27 |
28 | - Supports ES2015+ in test files.
29 | - Easy [mocking](https://facebook.github.io/jest/docs/mock-functions.html).
30 |
31 | ### `npm run e2e`
32 |
33 | > Run end-to-end tests with [Nightwatch](http://nightwatchjs.org/). See [End-to-end Testing](e2e.md) for more details.
34 |
35 | - Run tests in multiple browsers in parallel.
36 | - Works with one command out of the box:
37 | - Selenium and chromedriver dependencies automatically handled.
38 | - Automatically spawns the Selenium server.
39 |
--------------------------------------------------------------------------------
/docs/e2e.md:
--------------------------------------------------------------------------------
1 | # End-to-end Testing
2 |
3 | This boilerplate uses [Nightwatch.js](http://nightwatchjs.org) for e2e tests. Nightwatch.js is a highly integrated e2e test runner built on top of Selenium. This boilerplate comes with Selenium server and chromedriver binaries pre-configured for you, so you don't have to mess with these yourself.
4 |
5 | Let's take a look at the files in the `test/e2e` directory:
6 |
7 | - `runner.js`
8 |
9 | A Node.js script that starts the dev server, and then launches Nightwatch to run tests against it. This is the script that will run when you run `npm run e2e`.
10 |
11 | - `nightwatch.conf.js`
12 |
13 | Nightwatch configuration file. See [Nightwatch's docs on configuration](http://nightwatchjs.org/gettingstarted#settings-file) for more details.
14 |
15 | - `custom-assertions/`
16 |
17 | Custom assertions that can be used in Nightwatch tests. See [Nightwatch's docs on writing custom assertions](http://nightwatchjs.org/guide#writing-custom-assertions) for more details.
18 |
19 | - `specs/`
20 |
21 | Your actual tests! See [Nightwatch's docs on writing tests](http://nightwatchjs.org/guide#writing-tests) and [API reference](http://nightwatchjs.org/api) for more details.
22 |
23 | ### Running Tests in More Browsers
24 |
25 | To configure which browsers to run the tests in, add an entry under "test_settings" in [`test/e2e/nightwatch.conf.js`](https://github.com/vuejs-templates/webpack/blob/master/template/test/e2e/nightwatch.conf.js#L17-L39) , and also the `--env` flag in [`test/e2e/runner.js`](https://github.com/vuejs-templates/webpack/blob/master/template/test/e2e/runner.js#L15). If you wish to configure remote testing on services like SauceLabs, you can either make the Nightwatch config conditional based on environment variables, or use a separate config file altogether. Consult [Nightwatch's docs on Selenium](http://nightwatchjs.org/guide#selenium-settings) for more details.
26 |
--------------------------------------------------------------------------------
/docs/env.md:
--------------------------------------------------------------------------------
1 | # Environment Variables
2 |
3 | Sometimes it is practical to have different config values according to the environment that the application is running in.
4 |
5 | As an example:
6 |
7 | ```js
8 | // config/prod.env.js
9 | module.exports = {
10 | NODE_ENV: '"production"',
11 | DEBUG_MODE: false,
12 | API_KEY: '"..."' // this is shared between all environments
13 | }
14 |
15 | // config/dev.env.js
16 | module.exports = merge(prodEnv, {
17 | NODE_ENV: '"development"',
18 | DEBUG_MODE: true // this overrides the DEBUG_MODE value of prod.env
19 | })
20 |
21 | // config/test.env.js
22 | module.exports = merge(devEnv, {
23 | NODE_ENV: '"testing"'
24 | })
25 | ```
26 |
27 | > **Note:** string variables need to be wrapped into single and double quotes `'"..."'`
28 |
29 | So, the environment variables are:
30 | - Production
31 | - NODE_ENV = 'production',
32 | - DEBUG_MODE = false,
33 | - API_KEY = '...'
34 | - Development
35 | - NODE_ENV = 'development',
36 | - DEBUG_MODE = true,
37 | - API_KEY = '...'
38 | - Testing
39 | - NODE_ENV = 'testing',
40 | - DEBUG_MODE = true,
41 | - API_KEY = '...'
42 |
43 | As we can see, `test.env` inherits the `dev.env` and the `dev.env` inherits the `prod.env`.
44 |
45 | ### Usage
46 |
47 | It is simple to use the environment variables in your code. For example:
48 |
49 | ```js
50 | Vue.config.productionTip = process.env.NODE_ENV === 'production'
51 | ```
52 |
--------------------------------------------------------------------------------
/docs/linter.md:
--------------------------------------------------------------------------------
1 | # Linter Configuration
2 |
3 | This boilerplate uses [ESLint](https://eslint.org/) as the linter, and uses the [Standard](https://github.com/feross/standard/blob/master/RULES.md) preset with some small customizations.
4 |
5 | If you are not happy with the default linting rules, you have several options:
6 |
7 | 1. Overwrite individual rules in `.eslintrc.js`. For example, you can add the following rule to enforce semicolons instead of omitting them:
8 |
9 | ``` js
10 | // .eslintrc.js
11 | "semi": [2, "always"]
12 | ```
13 |
14 | 2. Pick a different ESLint preset when generating the project, for example [eslint-config-airbnb](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb).
15 |
16 | 3. Pick "none" for ESLint preset when generating the project and define your own rules. See [ESLint documentation](https://eslint.org/docs/rules/) for more details.
17 |
--------------------------------------------------------------------------------
/docs/pre-processors.md:
--------------------------------------------------------------------------------
1 | # Pre-Processors
2 |
3 | This boilerplate has pre-configured CSS extraction for most popular CSS pre-processors including LESS, SASS, Stylus, and PostCSS. To use a pre-processor, all you need to do is install the appropriate webpack loader for it. For example, to use SASS:
4 |
5 | ``` bash
6 | npm install sass-loader node-sass --save-dev
7 | ```
8 |
9 | Note you also need to install `node-sass` because `sass-loader` depends on it as a peer dependency.
10 |
11 | ### Using Pre-Processors inside Components
12 |
13 | Once installed, you can use the pre-processors inside your `*.vue` components using the `lang` attribute on `
19 | ```
20 |
21 | ### A note on SASS syntax
22 |
23 | - `lang="scss"` corresponds to the CSS-superset syntax (with curly braces and semicolons).
24 | - `lang="sass"` corresponds to the indentation-based syntax.
25 |
26 | ### PostCSS
27 |
28 | Styles in `*.vue` files are piped through PostCSS by default, so you don't need to use a specific loader for it. You can simply add PostCSS plugins you want to use in `build/webpack.base.conf.js` under the `vue` block:
29 |
30 | ``` js
31 | // build/webpack.base.conf.js
32 | module.exports = {
33 | // ...
34 | vue: {
35 | postcss: [/* your plugins */]
36 | }
37 | }
38 | ```
39 |
40 | See [vue-loader's related documentation](http://vuejs.github.io/vue-loader/en/features/postcss.html) for more details.
41 |
42 | ### Standalone CSS Files
43 |
44 | To ensure consistent extraction and processing, it is recommended to import global, standalone style files from your root `App.vue` component, for example:
45 |
46 | ``` html
47 |
48 |
49 | ```
50 |
51 | Note you should probably only do this for the styles written by yourself for your application. For existing libraries e.g. Bootstrap or Semantic UI, you can place them inside `/static` and reference them directly in `index.html`. This avoids extra build time and also is better for browser caching. (See [Static Asset Handling](static.md))
52 |
--------------------------------------------------------------------------------
/docs/prerender.md:
--------------------------------------------------------------------------------
1 | # Prerendering for SEO
2 |
3 | If you want to prerender routes that will not significantly change once pushed to production, use this Webpack plugin: [prerender-spa-plugin](https://www.npmjs.com/package/prerender-spa-plugin), which has been tested for use with Vue. For pages that _do_ frequently change, [Prerender.io](https://prerender.io/) and [Netlify](https://www.netlify.com/pricing) both offer plans for regularly re-prerendering your content for search engines.
4 |
5 | ## Using `prerender-spa-plugin`
6 |
7 | 1. Install it as a dev dependency:
8 |
9 | ```bash
10 | npm install --save-dev prerender-spa-plugin
11 | ```
12 |
13 | 2. Require it in **build/webpack.prod.conf.js**:
14 |
15 | ```js
16 | // This line should go at the top of the file where other 'imports' live in
17 | const PrerenderSpaPlugin = require('prerender-spa-plugin')
18 | ```
19 |
20 | 3. Configure it in the `plugins` array (also in **build/webpack.prod.conf.js**):
21 |
22 | ```js
23 | new PrerenderSpaPlugin(
24 | // Path to compiled app
25 | path.join(__dirname, '../dist'),
26 | // List of endpoints you wish to prerender
27 | [ '/' ]
28 | )
29 | ```
30 |
31 | If you also wanted to prerender `/about` and `/contact`, then that array would be `[ '/', '/about', '/contact' ]`.
32 |
33 | 4. Enable history mode for `vue-router`:
34 | ```js
35 | const router = new VueRouter({
36 | mode: 'history',
37 | routes: [...]
38 | })
39 | ```
40 |
--------------------------------------------------------------------------------
/docs/proxy.md:
--------------------------------------------------------------------------------
1 | # API Proxying During Development
2 |
3 | When integrating this boilerplate with an existing backend, a common need is to access the backend API when using the dev server. To achieve that, we can run the dev server and the API backend side-by-side (or remotely), and let the dev server proxy all API requests to the actual backend.
4 |
5 | To configure the proxy rules, edit `dev.proxyTable` option in `config/index.js`. The dev server is using [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware) for proxying, so you should refer to its docs for detailed usage. But here's a simple example:
6 |
7 | ``` js
8 | // config/index.js
9 | module.exports = {
10 | // ...
11 | dev: {
12 | proxyTable: {
13 | // proxy all requests starting with /api to jsonplaceholder
14 | '/api': {
15 | target: 'http://jsonplaceholder.typicode.com',
16 | changeOrigin: true,
17 | pathRewrite: {
18 | '^/api': ''
19 | }
20 | }
21 | }
22 | }
23 | }
24 | ```
25 |
26 | The above example will proxy the request `/api/posts/1` to `http://jsonplaceholder.typicode.com/posts/1`.
27 |
28 | ## URL Matching
29 |
30 | In addition to static urls you can also use glob patterns to match URLs, e.g. `/api/**`. See [Context Matching](https://github.com/chimurai/http-proxy-middleware#context-matching) for more details. In addition, you can provide a `filter` option that can be a custom function to determine whether a request should be proxied:
31 |
32 | ``` js
33 | proxyTable: {
34 | '**': {
35 | target: 'http://jsonplaceholder.typicode.com',
36 | filter: function (pathname, req) {
37 | return pathname.match('^/api') && req.method === 'GET'
38 | }
39 | }
40 | }
41 | ```
42 |
--------------------------------------------------------------------------------
/docs/static.md:
--------------------------------------------------------------------------------
1 | # Handling Static Assets
2 |
3 | You will notice in the project structure we have two directories for static assets: `src/assets` and `static/`. What is the difference between them?
4 |
5 | ### Webpacked Assets
6 |
7 | To answer this question, we first need to understand how Webpack deals with static assets. In `*.vue` components, all your templates and CSS are parsed by `vue-html-loader` and `css-loader` to look for asset URLs. For example, in `` and `background: url(./logo.png)`, `"./logo.png"` is a relative asset path and will be **resolved by Webpack as a module dependency**.
8 |
9 | Because `logo.png` is not JavaScript, when treated as a module dependency, we need to use `url-loader` and `file-loader` to process it. This template has already configured these loaders for you, so you get features such as filename fingerprinting and conditional base64 inlining for free, while being able to use relative/module paths without worrying about deployment.
10 |
11 | Since these assets may be inlined/copied/renamed during build, they are essentially part of your source code. This is why it is recommended to place Webpack-processed static assets inside `/src`, alongside other source files. In fact, you don't even have to put them all in `/src/assets`: you can organize them based on the module/component using them. For example, you can put each component in its own directory, with its static assets right next to it.
12 |
13 | ### Asset Resolving Rules
14 |
15 | - **Relative URLs**, e.g. `./assets/logo.png` will be interpreted as a module dependency. They will be replaced with an auto-generated URL based on your Webpack output configuration.
16 |
17 | - **Non-prefixed URLs**, e.g. `assets/logo.png` will be treated the same as the relative URLs and translated into `./assets/logo.png`.
18 |
19 | - **URLs prefixed with `~`** are treated as a module request, similar to `require('some-module/image.png')`. You need to use this prefix if you want to leverage Webpack's module resolving configurations. For example if you have a resolve alias for `assets`, you need to use `
` to ensure that alias is respected.
20 |
21 | - **Root-relative URLs**, e.g. `/assets/logo.png` are not processed at all.
22 |
23 | ### Getting Asset Paths in JavaScript
24 |
25 | In order for Webpack to return the correct asset paths, you need to use `require('./relative/path/to/file.jpg')`, which will get processed by `file-loader` and returns the resolved URL. For example:
26 |
27 | ``` js
28 | computed: {
29 | background () {
30 | return require('./bgs/' + this.id + '.jpg')
31 | }
32 | }
33 | ```
34 |
35 | **Note the above example will include every image under `./bgs/` in the final build.** This is because Webpack cannot guess which of them will be used at runtime, so it includes them all.
36 |
37 | ### "Real" Static Assets
38 |
39 | In comparison, files in `static/` are not processed by Webpack at all: they are directly copied to their final destination as-is, with the same filename. You must reference these files using absolute paths, which is determined by joining `build.assetsPublicPath` and `build.assetsSubDirectory` in `config.js`.
40 |
41 | As an example, with the following default values:
42 |
43 | ``` js
44 | // config/index.js
45 | module.exports = {
46 | // ...
47 | build: {
48 | assetsPublicPath: '/',
49 | assetsSubDirectory: 'static'
50 | }
51 | }
52 | ```
53 |
54 | Any file placed in `static/` should be referenced using the absolute URL `/static/[filename]`. If you change `assetSubDirectory` to `assets`, then these URLs will need to be changed to `/assets/[filename]`.
55 |
56 | We will learn more about the config file in the section about [backend integration](backend.md).
57 |
--------------------------------------------------------------------------------
/docs/structure.md:
--------------------------------------------------------------------------------
1 | # Project Structure
2 |
3 | ``` bash
4 | .
5 | ├── build/ # webpack config files
6 | │ └── ...
7 | ├── config/
8 | │ ├── index.js # main project config
9 | │ └── ...
10 | ├── src/
11 | │ ├── main.js # app entry file
12 | │ ├── App.vue # main app component
13 | │ ├── components/ # ui components
14 | │ │ └── ...
15 | │ └── assets/ # module assets (processed by webpack)
16 | │ └── ...
17 | ├── static/ # pure static assets (directly copied)
18 | ├── test/
19 | │ └── unit/ # unit tests
20 | │ │ ├── specs/ # test spec files
21 | │ │ ├── setup.js # file that runs before Jest tests
22 | │ │ ├── index.js # test build entry file
23 | │ │ └── karma.conf.js # test runner config file
24 | │ └── e2e/ # e2e tests
25 | │ │ ├── specs/ # test spec files
26 | │ │ ├── custom-assertions/ # custom assertions for e2e tests
27 | │ │ ├── runner.js # test runner script
28 | │ │ └── nightwatch.conf.js # test runner config file
29 | ├── .babelrc # babel config
30 | ├── .postcssrc.js # postcss config
31 | ├── .eslintrc.js # eslint config
32 | ├── .editorconfig # editor config
33 | ├── index.html # index.html template
34 | └── package.json # build scripts and dependencies
35 | ```
36 |
37 | ### `build/`
38 |
39 | This directory holds the actual configurations for both the development server and the production webpack build. Normally you don't need to touch these files unless you want to customize Webpack loaders, in which case you should probably look at `build/webpack.base.conf.js`.
40 |
41 | ### `config/index.js`
42 |
43 | This is the main configuration file that exposes some of the most common configuration options for the build setup. See [API Proxying During Development](proxy.md) and [Integrating with Backend Framework](backend.md) for more details.
44 |
45 | ### `src/`
46 |
47 | This is where most of your application code will live in. How to structure everything inside this directory is largely up to you; if you are using Vuex, you can consult the [recommendations for Vuex applications](http://vuex.vuejs.org/en/structure.html).
48 |
49 | ### `static/`
50 |
51 | This directory is an escape hatch for static assets that you do not want to process with Webpack. They will be directly copied into the same directory where webpack-built assets are generated.
52 |
53 | See [Handling Static Assets](static.md) for more details.
54 |
55 | ### `test/unit`
56 |
57 | Contains unit test related files. See [Unit Testing](unit.md) for more details.
58 |
59 | ### `test/e2e`
60 |
61 | Contains e2e test related files. See [End-to-end Testing](e2e.md) for more details.
62 |
63 | ### `index.html`
64 |
65 | This is the **template** `index.html` for our single page application. During development and builds, Webpack will generate assets, and the URLs for those generated assets will be automatically injected into this template to render the final HTML.
66 |
67 | ### `package.json`
68 |
69 | The NPM package meta file that contains all the build dependencies and [build commands](commands.md).
70 |
--------------------------------------------------------------------------------
/docs/unit.md:
--------------------------------------------------------------------------------
1 | # Unit Testing
2 |
3 | This project offers two options for unit testing:
4 |
5 | 1. Jest
6 | 2. Karma and Mocha.
7 |
8 |
9 | ## Jest
10 |
11 | - [Jest](https://facebook.github.io/jest/): the test runner that launches JSDOM runs the tests and reports the results to us.
12 |
13 | ### Files
14 |
15 | - `setup.js`
16 |
17 | Jest runs this file before it runs the unit tests. It sets the Vue production tip to false.
18 |
19 | ### Mocking Dependencies
20 |
21 | The Jest boilerplate comes with the ability to mock dependencies. See the [mock functions guide](https://facebook.github.io/jest/docs/mock-functions.html) for more details.
22 |
23 | ## Karma and Mocha
24 |
25 | - [Karma](https://karma-runner.github.io/): the test runner that launches browsers, runs the tests and reports the results to us.
26 | - [karma-webpack](https://github.com/webpack/karma-webpack): the plugin for Karma that bundles our tests using Webpack.
27 | - [Mocha](https://mochajs.org/): the test framework that we write test specs with.
28 | - [Chai](http://chaijs.com/): test assertion library that provides better assertion syntax.
29 | - [Sinon](http://sinonjs.org/): test utility library that provides spies, stubs and mocks.
30 |
31 | Chai and Sinon are integrated using [karma-sinon-chai](https://github.com/kmees/karma-sinon-chai), so all Chai interfaces (`should`, `expect`, `assert`) and `sinon` are globally available in test files.
32 |
33 | ### Files
34 |
35 | - `index.js`
36 |
37 | This is the entry file used by `karma-webpack` to bundle all the test code and source code (for coverage purposes). You can ignore it for the most part.
38 |
39 | - `specs/`
40 |
41 | This directory is where you write your actual tests. You can use full ES2015+ and all supported Webpack loaders in your tests.
42 |
43 | - `karma.conf.js`
44 |
45 | This is the Karma configuration file. See [Karma docs](https://karma-runner.github.io/) for more details.
46 |
47 | ### Running Tests in More Browsers
48 |
49 | You can run the tests in multiple real browsers by installing more [karma launchers](https://karma-runner.github.io/1.0/config/browsers.html) and adjusting the `browsers` field in `test/unit/karma.conf.js`.
50 |
51 | ### Mocking Dependencies
52 |
53 | The Karma unit test boilerplate comes with [inject-loader](https://github.com/plasticine/inject-loader) installed by default. For usage with `*.vue` components, see [vue-loader docs on testing with mocks](http://vue-loader.vuejs.org/en/workflow/testing-with-mocks.html).
54 |
--------------------------------------------------------------------------------
/meta.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | "helpers": {
3 | "if_or": function (v1, v2, options) {
4 | if (v1 || v2) {
5 | return options.fn(this);
6 | }
7 |
8 | return options.inverse(this);
9 | }
10 | },
11 | "prompts": {
12 | "name": {
13 | "type": "string",
14 | "required": true,
15 | "message": "Project name"
16 | },
17 | "description": {
18 | "type": "string",
19 | "required": false,
20 | "message": "Project description",
21 | "default": "A Vue.js project"
22 | },
23 | "author": {
24 | "type": "string",
25 | "message": "Author"
26 | },
27 | "build": {
28 | "type": "list",
29 | "message": "Vue build",
30 | "choices": [
31 | {
32 | "name": "Runtime + Compiler: recommended for most users",
33 | "value": "standalone",
34 | "short": "standalone"
35 | },
36 | {
37 | "name": "Runtime-only: about 6KB lighter min+gzip, but templates (or any Vue-specific HTML) are ONLY allowed in .vue files - render functions are required elsewhere",
38 | "value": "runtime",
39 | "short": "runtime"
40 | }
41 | ]
42 | },
43 | "router": {
44 | "type": "confirm",
45 | "message": "Install vue-router?"
46 | },
47 | "sass": {
48 | "type": "confirm",
49 | "message": "Handle sass syntax?"
50 | },
51 | "lint": {
52 | "type": "confirm",
53 | "message": "Use ESLint to lint your code?"
54 | },
55 | "lintConfig": {
56 | "when": "lint",
57 | "type": "list",
58 | "message": "Pick an ESLint preset",
59 | "choices": [
60 | {
61 | "name": "Standard (https://github.com/standard/standard)",
62 | "value": "standard",
63 | "short": "Standard"
64 | },
65 | {
66 | "name": "Airbnb (https://github.com/airbnb/javascript)",
67 | "value": "airbnb",
68 | "short": "Airbnb"
69 | },
70 | {
71 | "name": "none (configure it yourself)",
72 | "value": "none",
73 | "short": "none"
74 | }
75 | ]
76 | },
77 | "unit": {
78 | "type": "confirm",
79 | "message": "Setup unit tests"
80 | },
81 | "runner": {
82 | "when": "unit",
83 | "type": "list",
84 | "message": "Pick a test runner",
85 | "choices": [
86 | {
87 | "name": "Jest",
88 | "value": "jest",
89 | "short": "jest"
90 | },
91 | {
92 | "name": "Karma and Mocha",
93 | "value": "karma",
94 | "short": "karma"
95 | },
96 | {
97 | "name": "none (configure it yourself)",
98 | "value": "noTest",
99 | "short": "noTest"
100 | }
101 | ]
102 | },
103 | "e2e": {
104 | "type": "confirm",
105 | "message": "Setup e2e tests with Nightwatch?"
106 | }
107 | },
108 | "filters": {
109 | ".eslintrc.js": "lint",
110 | ".eslintignore": "lint",
111 | "config/test.env.js": "unit || e2e",
112 | "test/unit/**/*": "unit",
113 | "test/unit/index.js": "unit && runner === 'karma'",
114 | "test/unit/karma.conf.js": "unit && runner === 'karma'",
115 | "test/unit/specs/index.js": "unit && runner === 'karma'",
116 | "test/unit/setup.js": "unit && runner === 'jest'",
117 | "test/e2e/**/*": "e2e",
118 | "src/router/**/*": "router"
119 | },
120 | "completeMessage": "To get started:\n\n {{^inPlace}}cd {{destDirName}}\n {{/inPlace}}npm install\n npm run dev\n\nDocumentation can be found at https://vuejs-templates.github.io/webpack"
121 | };
122 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-cli-template-webpack-vue-django",
3 | "version": "1.2.3",
4 | "license": "MIT",
5 | "description": "A webpack template derived, with vue and django setup, no ceremony",
6 | "scripts": {
7 | "docs": "cd docs && gitbook serve",
8 | "docs:deploy": "bash ./deploy-docs.sh"
9 | },
10 | "devDependencies": {
11 | "vue-cli": "^2.8.1"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/template/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", {
4 | "modules": false
5 | }],
6 | "stage-2"
7 | ],
8 | "plugins": ["transform-runtime"],
9 | "env": {
10 | "test": {
11 | "presets": ["env", "stage-2"]{{#if_eq runner "karma"}},
12 | "plugins": ["istanbul"]
13 | {{/if_eq}}
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/template/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/template/.eslintignore:
--------------------------------------------------------------------------------
1 | /build/
2 | /config/
3 | /dist/
4 | /*.js
5 | {{#unit}}
6 | /test/unit/coverage/
7 | {{/unit}}
8 |
--------------------------------------------------------------------------------
/template/.eslintrc.js:
--------------------------------------------------------------------------------
1 | // https://eslint.org/docs/user-guide/configuring
2 |
3 | module.exports = {
4 | root: true,
5 | parser: 'babel-eslint',
6 | parserOptions: {
7 | sourceType: 'module'
8 | },
9 | env: {
10 | browser: true,
11 | },
12 | {{#if_eq lintConfig "standard"}}
13 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md
14 | extends: 'standard',
15 | {{/if_eq}}
16 | {{#if_eq lintConfig "airbnb"}}
17 | extends: 'airbnb-base',
18 | {{/if_eq}}
19 | // required to lint *.vue files
20 | plugins: [
21 | 'html'
22 | ],
23 | {{#if_eq lintConfig "airbnb"}}
24 | // check if imports actually resolve
25 | 'settings': {
26 | 'import/resolver': {
27 | 'webpack': {
28 | 'config': 'build/webpack.base.conf.js'
29 | }
30 | }
31 | },
32 | {{/if_eq}}
33 | // add your custom rules here
34 | 'rules': {
35 | {{#if_eq lintConfig "standard"}}
36 | // allow paren-less arrow functions
37 | 'arrow-parens': 0,
38 | // allow async-await
39 | 'generator-star-spacing': 0,
40 | {{/if_eq}}
41 | {{#if_eq lintConfig "airbnb"}}
42 | // don't require .vue extension when importing
43 | 'import/extensions': ['error', 'always', {
44 | 'js': 'never',
45 | 'vue': 'never'
46 | }],
47 | // allow optionalDependencies
48 | 'import/no-extraneous-dependencies': ['error', {
49 | 'optionalDependencies': ['test/unit/index.js']
50 | }],
51 | {{/if_eq}}
52 | // allow debugger during development
53 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/template/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | /dist/
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | {{#unit}}
8 | /test/unit/coverage/
9 | {{/unit}}
10 | {{#e2e}}
11 | /test/e2e/reports/
12 | selenium-debug.log
13 | {{/e2e}}
14 |
15 | # Editor directories and files
16 | .idea
17 | .vscode
18 | *.suo
19 | *.ntvs*
20 | *.njsproj
21 | *.sln
22 |
--------------------------------------------------------------------------------
/template/.postcssrc.js:
--------------------------------------------------------------------------------
1 | // https://github.com/michael-ciniawsky/postcss-load-config
2 |
3 | module.exports = {
4 | "plugins": {
5 | // to edit target browsers: use "browserslist" field in package.json
6 | "postcss-import": {},
7 | "autoprefixer": {}
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/template/Makefile:
--------------------------------------------------------------------------------
1 | # Use development settings for running django dev server.
2 | export DJANGO_SETTINGS_MODULE=backend.settingsdev
3 |
4 | # Initializes virtual environment with basic requirements.
5 | prod:
6 | pip install -r requirements.txt
7 | npm install --production
8 |
9 | # Installs development requirements.
10 | dev:
11 | pip install -r requirements.txt
12 | pip install -r requirements-dev.txt
13 | npm install
14 |
15 | # Runs development server.
16 | # This step depends on `make dev`, however dependency is excluded to speed up dev server startup.
17 | run:
18 | npm run dev & python ./manage.py runserver
19 |
20 | # Creates migrations and migrates database.
21 | # This step depends on `make dev`, however dependency is excluded to speed up dev server startup.
22 | migrate:
23 | python ./manage.py makemigrations
24 | python ./manage.py migrate
25 |
26 | # Builds files for distribution which will be placed in /static/dist
27 | build: prod migrate
28 | npm run build
29 |
30 | # Cleans up folder by removing virtual environment, node modules and generated files.
31 | clean:
32 | rm -rf node_modules
33 | rm -rf static/dist
34 |
35 | # Run linter
36 | lint:
37 | @npm run lint --silent
38 |
39 | # Run test
40 | test: dev
41 | python ./manage.py test
42 | npm run test
43 |
44 |
--------------------------------------------------------------------------------
/template/README.md:
--------------------------------------------------------------------------------
1 | # {{ name }}
2 |
3 | > {{ description }}
4 |
5 | ## Build Setup
6 |
7 | ``` bash
8 | # install dependencies
9 | npm install
10 |
11 | # serve with hot reload at localhost:8001
12 | npm run dev
13 |
14 | # build for production with minification
15 | npm run build
16 |
17 | # build for production and view the bundle analyzer report
18 | npm run build --report
19 | {{#unit}}
20 |
21 | # run unit tests
22 | npm run unit
23 | {{/unit}}
24 | {{#e2e}}
25 |
26 | # run e2e tests
27 | npm run e2e
28 | {{/e2e}}
29 | {{#if_or unit e2e}}
30 |
31 | # run all tests
32 | npm test
33 | {{/if_or}}
34 | ```
35 |
36 | For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
37 |
--------------------------------------------------------------------------------
/template/backend/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CharlesAracil/webpack-vue-django/0787422019f980482b3ea62288c63c3abf3043f0/template/backend/__init__.py
--------------------------------------------------------------------------------
/template/backend/settings.py:
--------------------------------------------------------------------------------
1 | """
2 | Django settings for backend project.
3 |
4 | Generated by 'django-admin startproject' using Django 1.11.4.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/1.11/topics/settings/
8 |
9 | For the full list of settings and their values, see
10 | https://docs.djangoproject.com/en/1.11/ref/settings/
11 | """
12 |
13 | import os
14 |
15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17 |
18 | # Quick-start development settings - unsuitable for production
19 | # See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
20 |
21 | # SECURITY WARNING: keep the secret key used in production secret!
22 | SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', 'VERY_SECRET_KEY_THAT_YOU_SHOULD_CHANGE')
23 |
24 | # SECURITY WARNING: don't run with debug turned on in production!
25 | DEBUG = False
26 |
27 | ALLOWED_HOSTS = []
28 |
29 | # Application definition
30 |
31 | INSTALLED_APPS = [
32 | 'django.contrib.admin',
33 | 'django.contrib.auth',
34 | 'django.contrib.contenttypes',
35 | 'django.contrib.sessions',
36 | 'django.contrib.messages',
37 | 'django.contrib.staticfiles',
38 | 'webpack_loader',
39 | 'backend',
40 | ]
41 |
42 | MIDDLEWARE = [
43 | 'django.middleware.security.SecurityMiddleware',
44 | 'django.contrib.sessions.middleware.SessionMiddleware',
45 | 'django.middleware.common.CommonMiddleware',
46 | 'django.middleware.csrf.CsrfViewMiddleware',
47 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
48 | 'django.contrib.messages.middleware.MessageMiddleware',
49 | 'django.middleware.clickjacking.XFrameOptionsMiddleware',
50 | ]
51 |
52 | ROOT_URLCONF = 'backend.urls'
53 |
54 | TEMPLATES = [
55 | {
56 | 'BACKEND': 'django.template.backends.django.DjangoTemplates',
57 | 'DIRS': [],
58 | 'APP_DIRS': True,
59 | 'OPTIONS': {
60 | 'context_processors': [
61 | 'django.template.context_processors.debug',
62 | 'django.template.context_processors.request',
63 | 'django.contrib.auth.context_processors.auth',
64 | 'django.contrib.messages.context_processors.messages',
65 | ],
66 | },
67 | },
68 | ]
69 |
70 | WSGI_APPLICATION = 'backend.wsgi.application'
71 |
72 | # Database
73 | # https://docs.djangoproject.com/en/1.10/ref/settings/#databases
74 |
75 | DATABASES = {
76 | 'default': {
77 | 'ENGINE': 'django.db.backends.sqlite3',
78 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
79 | }
80 | }
81 |
82 | # Password validation
83 | # https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
84 |
85 | AUTH_PASSWORD_VALIDATORS = [
86 | {
87 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
88 | },
89 | {
90 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
91 | },
92 | {
93 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
94 | },
95 | {
96 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
97 | },
98 | ]
99 |
100 | # Internationalization
101 | # https://docs.djangoproject.com/en/1.10/topics/i18n/
102 |
103 | LANGUAGE_CODE = 'en-us'
104 | TIME_ZONE = 'UTC'
105 | USE_I18N = True
106 | USE_L10N = True
107 | USE_TZ = True
108 |
109 | # Static files (CSS, JavaScript, Images)
110 | # https://docs.djangoproject.com/en/1.10/howto/static-files/
111 |
112 | STATIC_URL = '/static/'
113 | STATICFILES_DIRS = [
114 | os.path.join(BASE_DIR, 'static'),
115 | ]
116 | STATIC_ROOT = os.path.join(BASE_DIR, 'public')
117 |
118 | WEBPACK_LOADER = {
119 | 'DEFAULT': {
120 | 'BUNDLE_DIR_NAME': '',
121 | 'STATS_FILE': os.path.join(BASE_DIR, 'webpack-stats.json'),
122 | },
123 | 'DEFAULT': {
124 | 'CACHE': not DEBUG
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/template/backend/settingsdev.py:
--------------------------------------------------------------------------------
1 | from .settings import *
2 |
3 | DEBUG = True
4 | INTERNAL_IPS = ['127.0.0.1']
5 | ALLOWED_HOSTS += INTERNAL_IPS
6 | ALLOWED_HOSTS.append('localhost')
7 | INSTALLED_APPS.append('debug_toolbar')
8 | MIDDLEWARE.append('debug_toolbar.middleware.DebugToolbarMiddleware')
9 |
--------------------------------------------------------------------------------
/template/backend/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 | {% load render_bundle from webpack_loader %}
3 |
4 |