Modern Django App with React: Difference between revisions
(Created page with "Install NPM (you likely already have it) <pre> sudo apt-get install nodejs npm <pre> Install Django <pre> pip install django </pre> Start the app <pre>django-admin startpro...") |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
<pre> | <pre> | ||
sudo apt-get install nodejs npm | sudo apt-get install nodejs npm | ||
<pre> | </pre> | ||
Install Django | Install Django | ||
<pre> | <pre> | ||
pip install django | pip install django | ||
pip install django-compressor django-compressor-toolkit | |||
</pre> | </pre> | ||
Line 20: | Line 21: | ||
Init Git | Init Git | ||
<pre>git init</pre> | <pre>git init</pre> | ||
Init NPM (creates package.json) | |||
<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