Skip to content

Commit da7b55c

Browse files
author
wzhu
committed
Initial Setup...
1 parent 0cf4b45 commit da7b55c

File tree

17 files changed

+350
-0
lines changed

17 files changed

+350
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.venv
2+
.DS_Store
3+
client/node_modules
4+
client/yarn.lock
5+
db.sqlite3
6+
*.pyc
7+
.idea/*

client/component/app.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from "react";
2+
3+
const App = () => {
4+
return <div>Hello World</div>
5+
};
6+
7+
export default App;

client/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset = "UTF-8">
5+
<title>Django React Integration Demo App</title>
6+
</head>
7+
<body>
8+
<div id="root"></div>
9+
<script src="build/bundle.js"></script>
10+
</body>
11+
</html>

client/main.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
4+
import App from './component/app';
5+
import style from './style/app.less';
6+
7+
ReactDOM.render(<App />, document.getElementById('root'));

client/package.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "django-react",
3+
"version": "0.0.1",
4+
"description": "Demo project to setup django, reactjs, webpack",
5+
"main": "index.js",
6+
"repository": {
7+
"url": "https://github.com/coderwz/django-reactjs-env",
8+
"type": "git"
9+
},
10+
"author": "coderwz",
11+
"license": "MIT",
12+
"dependencies": {
13+
"babel-core": "^6.17.0",
14+
"babel-loader": "^6.2.5",
15+
"babel-preset-es2015": "^6.16.0",
16+
"babel-preset-react": "^6.16.0",
17+
"css": "^2.2.1",
18+
"css-loader": "^0.25.0",
19+
"path": "^0.12.7",
20+
"react": "^15.3.2",
21+
"react-dom": "^15.3.2",
22+
"webpack": "^1.13.2",
23+
"webpack-bundle-tracker": "^0.0.93"
24+
},
25+
"scripts": {
26+
"dev": "webpack-dev-server --hot --progress --colors",
27+
"prod": "NODE_ENV=production webpack -p"
28+
},
29+
"devDependencies": {
30+
"less": "^2.7.1",
31+
"less-loader": "^2.2.3",
32+
"style-loader": "^0.13.1",
33+
"webpack-dev-server": "^1.16.2"
34+
}
35+
}

client/style/app.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import "reset";

client/style/reset.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
* {
2+
margin: 0;
3+
padding: 0;
4+
}

client/webpack.config.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
var Webpack = require('webpack');
2+
var BundleTracker = require('webpack-bundle-tracker');
3+
var path = require('path');
4+
5+
var uglifyJsPlugin = Webpack.optimize.UglifyJsPlugin;
6+
var buildPath = path.resolve(__dirname, '../server/static');
7+
8+
9+
module.exports = {
10+
context: __dirname,
11+
devtool: 'eval',
12+
entry: './main.js',
13+
output: {
14+
path: buildPath,
15+
filename: 'bundle.js'
16+
},
17+
18+
module: {
19+
loaders: [
20+
{
21+
test: /\.jsx?$/,
22+
exclude: /node_modules/,
23+
loader: 'babel-loader?presets[]=es2015&presets[]=react',
24+
},
25+
{
26+
test: /\.less$/,
27+
loader: 'style!css!less!'
28+
},
29+
{
30+
test: /\.(png|jpg)$/,
31+
loader: 'url-loader?limit=8192'
32+
}
33+
]
34+
},
35+
36+
plugins: [
37+
new uglifyJsPlugin({
38+
compress: {
39+
warnings: false
40+
}
41+
}),
42+
new BundleTracker({
43+
path: buildPath,
44+
filename: 'webpack-stats.json'
45+
})
46+
],
47+
};

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Django==1.10.2
2+
django-webpack-loader==0.3.3

server/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)