Modern Django App with React: Difference between revisions
No edit summary |
No edit summary |
||
Line 24: | Line 24: | ||
Init NPM (creates package.json) | Init NPM (creates package.json) | ||
<pre>npm init</pre> | <pre>npm init</pre> | ||
Modify package.json and add to the root: | |||
<pre> | |||
"dependencies": { | |||
"babel": "^6.23.0", | |||
"react": "^17.0.1", | |||
"react-dom": "^17.0.1" | |||
}, | |||
</pre> | |||
<pre>"devDependencies": { | |||
"autoprefixer": "^7.1.2", | |||
"babel-preset-es2015": "^6.24.1", | |||
"babelify": "^7.3.0", | |||
"browserify": "^14.4.0", | |||
"node-sass": "^4.5.3", | |||
"postcss-cli": "^4.1.0" | |||
} | |||
</pre> | |||
Now install everything | |||
<pre>npm install</pre> |
Latest revision as of 07:30, 9 February 2021
Install NPM (you likely already have it)
sudo apt-get install nodejs npm
Install Django
pip install django pip install django-compressor django-compressor-toolkit
Start the app
django-admin startproject project
Run the app
cd project python manage.py runserver
Init Git
git init
Init NPM (creates package.json)
npm init
Modify package.json and add to the root:
"dependencies": { "babel": "^6.23.0", "react": "^17.0.1", "react-dom": "^17.0.1" },
"devDependencies": { "autoprefixer": "^7.1.2", "babel-preset-es2015": "^6.24.1", "babelify": "^7.3.0", "browserify": "^14.4.0", "node-sass": "^4.5.3", "postcss-cli": "^4.1.0" }
Now install everything
npm install