by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    konoufo
    @konoufo
    @megapctr except you probably don't want to use the WDS in production.
    Filip Figiel
    @megapctr
    Of course, I'd use a different static root in prod
    *static url
    liondancer
    @liondancer
    Now that Im using webpack and react as my frontend and django as my backend. I am having a hard time dealing with CSRF in forms. Before I dabbled with django templates and it was pretty easy to get CSRF setup but I am pretty lost on how to do this now
    konoufo
    @konoufo

    @liondancer , you've got several ways but this is how i'd do it. You just have to add an extra header to the request when submitting a form. I use superagent to post forms, so it would go like this:

    // 'cookie' is a tiny JS library used to easily interact with cookies 
    request
        .set('X-CSRFToken',  cookie.get('csrftoken')), 
        .send(formdata)
        .end(function(err, res){/*do this after request*/})

    Note that you should ensure that csrf cookies are used in your django view .

    Eitan R
    @erosenberg
    I guess this applies here too, @owais - but I'm trying to render_bundle 'main' 'css' and it's not finding it... any ideas?
    Owais Lone
    @owais
    Could you please share you webpack config, django settings, webpack build output. template code and contents of rendered HTML page?
    Eitan R
    @erosenberg
    @owais - yeah, I responded in the other room (webpack-bundle-tracker)... should I post it here instead?
    Owais Lone
    @owais
    No, let's discuss in a single place. The issue seems to be more relevant to bundle tracker anyway
    EmilLuta
    @EmilLuta

    Hello! I just wanted to introduce assets through the main pipeline, but I ran into issues trying to run tests and all that. Let me know when you have a minute so we can discuss about that. Thank you very much!

    P.S. Congrats on the work!

    Eitan R
    @erosenberg
    Hey webpack-django people! I'm running into proxy issues with my static assets, similar to this: http://stackoverflow.com/questions/35920691/static-files-not-found-with-webpack-and-django
    I'm trying to load images from my CSS using relative paths, but it believes those images are on my hot-reload server... any ideas?
    Alex Kahn
    @alexkahn
    Hey folks, just wondering if anyone has tried this library with webpack 2?
    Owais Lone
    @owais
    @alexkahn It should work with webpack2. Feel free to file a bug if it doesn't.
    Ian
    @IanT8

    Could someone please explain this code fragment from the webpack.config.js in the examples/hot-reload folder:

    {
      entry: [
          'webpack-dev-server/client?http://localhost:3000',
          'webpack/hot/only-dev-server',
          './assets/js/index'
      ]
    }

    I don't know what the first and second entry points are doing.

    Ian
    @IanT8
    I've got this hot-reload example working, but seems I have to run 3 consoles, (1) webpack --watch (2) python manage.py runserver and (3) node server.js. Is that right? It still doesn't seem to reload when I edit and save the "Hello World" message in assets/js/app.jsx. I'm puzzled.
    Ian
    @IanT8
    I discovered a CORS issue. To fix, I added headers: { "Access-Control-Allow-Origin": "*" } to server.js after the historyApiFallback: true, line.
    Ian
    @IanT8
    And only (1) python manage.py runserver and (2) node server.js are needed.
    François GUÉRIN
    @frague59
    Hi
    I'm new with webpack technology, and I've to upgrade a project to use it
    I've build the site arround jQuery / bootstrap 3, and a custom bunch of css (bs overridings) and js (forms)
    I've followed the http://owaislone.org/blog/webpack-plus-reactjs-and-django/ tutorial, but I does not understand where to put my own assets and how to "ask" to webpack to package them
    François GUÉRIN
    @frague59
    I also use a bunch of django apps, will they be bundled too ?
    Thanks for your help !
    Salar Rahmanian
    @softinio
    @frague59 great question I am trying to figure our the same hope someone here can help
    konoufo
    @konoufo
    It's pretty straight forward, there is an entry property in you webpack config. That's where you list all the files webpack bundles.
    konoufo
    @konoufo
    @frague59 Do you have static files in those django apps that you need to bundle ? If so you'll have to put those paths as well inside the entry property. To know what entryexpects see https://webpack.js.org/concepts/entry-points/
    Salar Rahmanian
    @softinio
    @konoufo do I have to list each file one by one or can I list directories?
    assume in addition to that need to add the appropriate loader like if its css files i need to add the css loader ?
    konoufo
    @konoufo
    @softinio You can't just list a directory unless you have an index.js file there that requires everything you need in that directory. But you could also use glob to do something like this:
    var glob = require("glob");
    // ...
    entry: glob.sync("./myfolder/**")
    Salar Rahmanian
    @softinio
    @konoufo thx for info
    Salar Rahmanian
    @softinio
    in my webpack config I am importing the css files I want included in the bundle by importing them in the entrypoint index.js file
    in my django template how do I access the different css files?
    ie how do I have the css files included
    I have added this to my template head: {% render_bundle 'main' 'css' %}
    but nothing appears
    any help really appreciate as clearly I am doing something wrong :-)
    konoufo
    @konoufo
    Did you actually build ? @softinio
    Salar Rahmanian
    @softinio
    yes
    Salar Rahmanian
    @softinio
    I have tried adding the css to entrypoint and as imports in the index.js file and neither work for me :(
    @konoufo
    ^^
    really appreciate your help
    konoufo
    @konoufo
    hum ok. can you upload you webpack-stats.json and webpack.config.js somewhere ?
    and put links here @softinio
    we help each others out :smile:
    Wojciech Niedźwiedź
    @Niedzwiedzw
    oh
    it's dead
    Pavel Tyurikov
    @paveltyurikov
    Hi, I was using webpack_loader with create-react-app configs and works fine with webpack 3. Now when I want to update to create-react-app 2.0.3 with webpack 4 it won't work :(
    Eray Erdin
    @erayerdin
    Hi everybody, I've seen this project supports Django>=1.6, which, to me, appeared too broad considering that we have 1.10, 1.11, 2.2 and 3.0 releases here. So, my question is, does it support Django 2.2?