mbrochh / django-reactjs-boilerplate Goto Github PK
View Code? Open in Web Editor NEWAn example how you can use ReactJS with your Django project.
An example how you can use ReactJS with your Django project.
I was getting errors regarding cross-site requests when doing Step 5. This is the error message I received in the browser console:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:3000/assets/bundles/ce1bf8085cbd65984219.hot-update.json. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
[HMR] Update check failed: hotDownloadManifest/request.onreadystatechange@http://localhost:3000/assets/bundles/vendors.js:57:23
I am using [email protected]
, firefox@58
, and [email protected]
.
Your instruction say cd django-react-boilerplate/django, but it's actually cd django-reactjs-boilerplate/django
Let me say that this is awesome repository/boilerplate for django and react. I noticed that when I updated react hot loader this does not work any more.
The following modules couldn't be hot updated: (They would need a full reload!)
I tried to play around a bit, but with out any luck if any1 has a solution please let me know.
Hi all,
I can run this fine on my computer but when I try to host it on a server I am encountering a bunch of problems.
Basically - What would be the easiest way to host this on a server?
Thanks,
Hi I'm new to Django and React and absolutely LOVE this boilerplate! I was wondering how to add a button in App1 redirects/links the site to App2. Is there a way to change the URL of the django app in the react code? I'm confused on how to do this. Thanks!!
Hi,
You have a typo in your main readme. The setup instruction says:
cd django-react-boilerplace/django
but it should say
cd django-reactjs-boilerplate/django
.
Thanks for posting this, but is there any chance you could more clearly indicate where we need to put these files? Where does the package.json file go? Does it go in the project root where manage.py is stored? or is it in the static folder? Etc. This tutorial is very difficult to follow because we have to guess where to put the files.
Thanks
Hi @mbrochh
Thanks a lot for this outstanding tutorial. I am following it closely 👍
Can you please elaborate on these settings which you provided in the "Going to Production" step?
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('staging'),
'BASE_API_URL': JSON.stringify('https://sandbox.example.com/api/v1/'),
}}),
What does BASE_API_URL
represents? Some API endpoint on your django server side?
I get this error in chrome console when I save my changes and webpack compiles :
XMLHttpRequest cannot load http://localhost:3000/assets/bundles/70e617bfdfcfc79ab38b.hot-update.json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access.
I tried using django-cors-headers library, but it didn't work !
Could somebody help me ?
This doesnt work for me.
node server.js gives me
Listening at undefined:3000
Hash: b391b3f4971c4817b076
Version: webpack 1.15.0
Time: 1076ms
Asset Size Chunks Chunk Names
App1-b391b3f4971c4817b076.js 2.46 MB 0, 1 [emitted] App1
vendors.js 24.4 kB 1 [emitted] vendors
chunk {0} App1-b391b3f4971c4817b076.js (App1) 893 kB {1} [rendered]
[0] multi App1 52 bytes {0} [built]
[1] (webpack)-dev-server/client?http://localhost:3000 4.16 kB {0} [built]
[2] .//url/url.js 23.3 kB {0} [built]/url/~/punycode/punycode.js 14.6 kB {0} [built]
[3] ./
[4] (webpack)/buildin/module.js 251 bytes {0} [built].
.
.[243] ./
/react/lib/deprecated.js 1.77 kB {0} [built]/react-dom/index.js 63 bytes {0} [built]
[244] ./
[245] ./reactjs/containers/App1Container.jsx 4.21 kB {0} [built]
[246] ./reactjs/components/Headline.jsx 3.7 kB {0} [built]
[247] .//react-hot-loader/makeExportsHot.js 1.73 kB {0} [built]/react-hot-loader/isReactClassish.js 801 bytes {0} [built]
[248] ./
[249] ./~/react-hot-loader/isReactElementish.js 288 bytes {0} [built]
chunk {1} vendors.js (vendors) 0 bytes [rendered]
webpack: Compiled successfully.
I notice in the video this ended as
webpack: bundle is now VALID
any help appreciated.
The print
command here https://github.com/mbrochh/django-reactjs-boilerplate/blob/master/django/djreact/settings.py#L126 requires parentheses when using python 3
Since node server.js
is needed to generate webpack-stats-local.json
it should be added to the readme.
branch: step5_hot_reloading
issue: config.ip
is not defined in server.js
ip
should be added to config in webpack.local.config.js
Great tutorial!
when I set up all the things and type url in chrome, such as: http://localhost:8000 and my url turn to http://localhost:8000/?_k=i26vli. The _k is always changing while refresh.
How does it come?
Thank you for replying me.
Remove it from the repo?
Please also change the IP in webpack.local-settings.js.sample
to 127.0.0.1
.
Is posible run fabric script usin a webpack inside of the project:
def webpack(): local('rm -rf djreact/static/bundles/stage/*') local('rm -rf djreact/static/bundles/prod/*') local('node_modules/.bin/webpack --config webpack.stage.config.js --progress --colors') local('node_modules/.bin/webpack --config webpack.prod.config.js --progress --colors')
I have a problem with the following mensage : "webpack" is not reconize how a command in or out
Thanks.
I had a problem whem I put directly 'localhost:8000/login' on my browser, the app make a request to server and server responses 'Pages not foud'. Only works when I click in the navbar link.
Someone else?
can someone provide updated package.json with new webpack?
This happens because of a dependency conflict.
npm ERR! peerinvalid The package [email protected] does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants eslint@<2.3.0
I had to run npm install [email protected]
afterwards to fix it.
Is this still being maintained? By the looks of it, it isn't even being looked at. I've been wanting to send a few PR's to update to newer versions, etc. If anyone knows of an existing Django + React boilerplate like this one that's up to date I'd really appreciate the guidance.
Hi the older version of fabric gives an error relating to Crypto , just upgrading the line in requrements.txt
to have the Fabric line read as follows:
Fabric==1.11.1
and running the following command :
pip install -r requirements.txt
will result in the Fab command working as expected.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.