Skip to content

Commit 09ce0c8

Browse files
authored
Routine scrutiny of the boilerplate (#215)
* Update testing on the boilerplate * Update README * Update django from 2.0.5 to 2.0.7 (#214) * Update message after vue-cli command run * Fix reported error on Github issues * Update boilerplate * Add coveralls badge
1 parent 3062a00 commit 09ce0c8

File tree

12 files changed

+43
-20
lines changed

12 files changed

+43
-20
lines changed

README.md

+18-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# vue-django-webpack-boilerplate
22

3-
> [@NdagiStanley](https://github.com/NdagiStanley) has mirrored the [fork](https://github.com/NdagiStanley/vue-django-fork) to have this repo here. This starterpack has proved useful to many and I thank you for the emails I have received from all of you. The reasoning behind this mirror is that this is an effort to **support the users** more by develop further on this project. From here on, I am calling on all potential collaborators by making it easier to make [PRs](https://github.com/NdagiStanley/vue-django/pulls) and adding utility of [Issues](https://github.com/NdagiStanley/vue-django/issues) in this 'new' repo (Of course with the same name :) ). Lastly, just so you know, I'll be keeping up with developments in the [`original`](https://github.com/vuejs-templates/webpack).
3+
> [@NdagiStanley](https://github.com/NdagiStanley) has mirrored the [fork](https://github.com/NdagiStanley/vue-django-fork) to have this repo here. This starterpack has proved useful to many and I thank you for the emails I have received from all of you. The reasoning behind this mirror is that this is an effort to **support the users** more by developing further on this project. From here on, I am calling on all potential collaborators by making it easier to make [PRs](https://github.com/NdagiStanley/vue-django/pulls) and adding utility of [Issues](https://github.com/NdagiStanley/vue-django/issues) in this 'new' repo (Of course with the same name :) ). Lastly, just so you know, I'll be keeping up with developments in the [`original`](https://github.com/vuejs-templates/webpack).
44
55
<p align="center">
66
<b>Listed in</b>
@@ -26,6 +26,7 @@ Common topics are discussed in the [docs](http://vuejs-templates.github.io/webpa
2626
[![Build Status](https://semaphoreci.com/api/v1/stanmd/vue-django/branches/develop/badge.svg)](https://semaphoreci.com/stanmd/vue-django)
2727
[![Updates](https://pyup.io/repos/github/NdagiStanley/vue-django/shield.svg)](https://pyup.io/repos/github/NdagiStanley/vue-django/)
2828
[![Python 3](https://pyup.io/repos/github/NdagiStanley/vue-django/python-3-shield.svg)](https://pyup.io/repos/github/NdagiStanley/vue-django/)
29+
[![Coverage Status](https://coveralls.io/repos/github/NdagiStanley/vue-django/badge.svg)](https://coveralls.io/github/NdagiStanley/vue-django)
2930

3031
[https://vuedjango.herokuapp.com/](https://vuedjango.herokuapp.com/) is a deployed instance of this boilerplate.
3132

@@ -38,6 +39,8 @@ This is a project template that includes `VueJS` and `Django` based on the [vue-
3839
``` bash
3940
$ npm install -g vue-cli
4041
```
42+
43+
### Set up
4144
You might want to use ```sudo``` if you encounter permissions error
4245
```bash
4346
$ vue init NdagiStanley/vue-django my-project
@@ -47,18 +50,26 @@ $ npm install
4750

4851
Secondly, have *Python* installed and preferably create a virtual environment for the project.
4952

50-
To develop
51-
53+
### Develop
54+
Run:
5255
```bash
5356
$ npm run dev
5457
```
5558

56-
## Deploy
57-
To deploy your django project, still within `my-project` directory, run:
59+
The app runs on [localhost:8080](http://localhost:8080/)
60+
61+
Update the files as you wish and the hot-reload will take effect. Add `js` and `css` files within the `static` folder in the root directory. Link them to the index.html in that same level (the root directory).
5862

59-
`$ .deploy.sh`
63+
### Deploy
64+
Ensure you have run `npm install` prior to the following command.
65+
66+
Run:
67+
```bash
68+
$ .deploy.sh
69+
```
70+
(Run this command every time you make changes)
6071

61-
Then get to [localhost:8000](http://localhost:8000/). You should have a page exactly like the image below or as the deployed instance mentioned earlier: [https://vuedjango.herokuapp.com/](https://vuedjango.herokuapp.com/)
72+
At [localhost:8000](http://localhost:8000/) you should have a page exactly like the image below or as the deployed instance mentioned earlier: [https://vuedjango.herokuapp.com/](https://vuedjango.herokuapp.com/)
6273

6374
<p align="center">
6475
<img src="http://i.imgur.com/sY3IpBE.png?1" align="center" height="500" alt="Vue-Django">

docs/README.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,31 @@ If you desire to use VueJS version 2.x with Django vesion 1.x run:
7373
```bash
7474
$ cd my-project
7575
$ npm install
76+
```
77+
78+
### Development
79+
80+
Run:
81+
```bash
7682
$ npm run dev
7783
```
7884

85+
and edit away. `Hot reload` is enabled so any changes on `index.html` and the other files will reflect on [localhost:8080](http://localhost:8080/)
86+
7987
### Deploy with Django (Locally)
8088

8189
Ensure python and pip is installed. Preferably create a virtual environment for the project.
8290

8391
```bash
84-
$ npm set progress=false && npm install -s --no-progress && npm run build
92+
$ npm run build
8593
$ pip install -r requirements.txt
8694
$ python format_index_html.py
8795
$ python manage.py collectstatic --noinput
96+
$ python manage.py migrate
8897
$ python manage.py runserver 0.0.0.0:8000
8998
```
9099

91-
The 5 commands above are contained in the `deploy.sh` so running the script is as good as running the aforementioned commands:
100+
The 6 commands above are contained in the `deploy.sh` so running the script is as good as running the aforementioned commands:
92101
```
93102
$ ./deploy.sh
94103
```

meta.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,5 +125,5 @@ module.exports = {
125125
"test/e2e/**/*": "e2e",
126126
"src/router/**/*": "router"
127127
},
128-
"completeMessage": "To get started:\n\n {{^inPlace}}cd {{destDirName}}\n {{/inPlace}}npm install\n npm run dev\n\nTo build and serve in Django:\n\n ./deploy.sh\n\nDocumentation can be found at https://goo.gl/V4eN7h"
128+
"completeMessage": "To get started:\n\n {{^inPlace}}cd {{destDirName}}\n {{/inPlace}}npm install\n\n To develop:\n\n npm run dev\n\nTo build and serve in Django:\n\n ./deploy.sh (Remember to do this in a python virtual environment)\n\nDocumentation can be found at https://goo.gl/V4eN7h"
129129
};

template/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ coverage.xml
3939
# Django stuff:
4040
*.log
4141
local_settings.py
42+
db.sqlite3
4243

4344
# dotenv
4445
.env

template/config/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ module.exports = {
5353
index: path.resolve(__dirname, '../templates/index.html'),
5454

5555
// Paths
56-
assetsRoot: path.resolve(__dirname, '../templates'),
57-
assetsSubDirectory: 'static',
56+
assetsRoot: path.resolve(__dirname, '../'),
57+
assetsSubDirectory: 'static-vuedj',
5858
assetsPublicPath: '/',
5959

6060
/**

template/deploy.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
echo 'Running npm install & npm build'
2-
npm set progress=false && npm install -s --no-progress && npm run build
1+
echo 'Run npm build'
2+
npm run build
33
echo 'Done...'
44

55
echo 'Format index.html as Jinja template'
@@ -14,6 +14,10 @@ echo 'Collect static'
1414
python manage.py collectstatic --noinput
1515
echo 'Done...'
1616

17+
echo 'Run migrations'
18+
python manage.py migrate
19+
echo 'Done...'
20+
1721
export PORT=8000
1822
echo 'Server runnning on port ' $PORT
1923
python manage.py runserver

template/format_index_html.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import sys
22
import fileinput
33

4-
file = 'index.html'
4+
file = 'templates/index.html'
55

66
with open(file, "r+") as f:
77
s = f.read()
88
f.seek(0)
99
f.write("{% load staticfiles %}\n" + s)
1010

1111
for i, line in enumerate(fileinput.input(file, inplace=1)):
12-
sys.stdout.write(line.replace('/static/', "{% static '"))
12+
sys.stdout.write(line.replace('/static-vuedj/', "{% static '"))
1313
for i, line in enumerate(fileinput.input(file, inplace=1)):
1414
sys.stdout.write(line.replace('.css', ".css' %}"))
1515
for i, line in enumerate(fileinput.input(file, inplace=1)):

template/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
coverage==4.5.1
22
coveralls==1.3.0
3-
Django==2.0.5
3+
Django==2.0.7
44
django-nose==1.4.5

template/static/css/.gitkeep

Whitespace-only changes.

template/static/js/.gitkeep

Whitespace-only changes.

template/vuedj/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
# https://docs.djangoproject.com/en/2.0/howto/static-files/
124124

125125
STATICFILES_DIRS = (
126-
os.path.join(BASE_DIR, 'templates/static'),
126+
os.path.join(BASE_DIR, 'static-vuedj'),
127127
)
128128

129129
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

vue-cli-interaction.exp

-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#!/usr/bin/expect -f
2-
32
# To be used primarily in CI (continuous integration)
43
set timeout 360
54
set BRANCH_NAME $env(BRANCH_NAME)
65

76
spawn vue init NdagiStanley/vue-django#$BRANCH_NAME my-project
8-
97
expect {
108
"Project name" { send "\n"; exp_continue }
119
"Project version" { send "\n"; exp_continue }

0 commit comments

Comments
 (0)