Giter Club home page Giter Club logo

Comments (2)

krisavi avatar krisavi commented on July 28, 2024 2

The issue is not with renames, error is thrown because the venv is not activated prior to running python command

Most likely on windows if using venv named venv, then the collectstatic row should be like below

    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "collect": "react-scripts build && npm run build-rename && npm run copy-buildfiles && npm run collectstatic",
    "build-rename": "npm run build-rename-js && npm run build-rename-css && npm run build-rename-logo",
    "build-rename-logo": "renamer --find \"/([^\\.]+)\\.[^\\.]+\\.(\\w+)/\" --replace \"$1.$2\" build/static/media/*",
    "build-rename-js": "renamer --find \"/main\\.[^\\.]+\\.js/i\" --replace \"reactify-django.ui.js\" build/static/js/*.js",
    "build-rename-css": "renamer --find \"/main\\..+\\.css/i\" --replace \"reactify-django.ui.css\" build/static/css/*.css",
    "copy-buildfiles": "npm run copy-build-js && npm run copy-build-css && npm run copy-build-logo",
    "copy-build-logo": "copyfiles -f \"build/static/media/*\" \"../staticfiles/img/\"",
    "copy-build-js": "copyfiles -f \"build/static/js/*\" \"../staticfiles/js/\"",
    "copy-build-css": "copyfiles -f \"build/static/css/*\" \"../staticfiles/css/\"",
    "collectstatic": "..\\venv\\Scripts\\activate && python ../manage.py collectstatic --no-input && deactivate"
  },

On linux and mac probably can use "../venv/Scripts/activate && python ../manage.py collectstatic --no-input && deactivate"
I am using updated renamer so the renamer command is with a bit different format (doesn't have --regexp part in it) and again windows specific " should be used, so I am using \" to escape the " character.
For me CSS was making in format: main.3b8d5aa4.chunk.css so modified it to accept everything between main. and .css, might be also due to using the latest versions of everything.

from reactify-django.

douglaspetrin avatar douglaspetrin commented on July 28, 2024 1

@Ishan3333 I had the same situation, so you can try this:

In your package.json change to those lines:

"scripts": {
"start": "react-scripts start",
"build": "react-scripts build && npm run build-rename ",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"collect": "react-scripts build && npm run build-rename && npm run copy-buildfiles && npm run collectstatic",
"build-rename": "npm run build-rename-js && npm run build-rename-css",
"build-rename-logo": "renamer --regex --find .g --replace logo.svg build/static/media/",
"build-rename-js": "renamer --regex --find .s --replace reactify-django.ui.js build/static/js/.js", "build-rename-css": "renamer --regex --find .s --replace reactify-django.ui.css build/static/css/.css",
"copy-buildfiles": "npm run copy-build-js && npm run copy-build-css && npm run copy-build-logo",
"copy-build-logo": "copyfiles -f build/static/media/* ../staticfiles/img/",
"copy-build-js": "copyfiles -f build/static/js/.js ../staticfiles/js/", "copy-build-css": "copyfiles -f build/static/css/.css ../staticfiles/css/",
"collectstatic": "python ../manage.py collectstatic --no-input"
}

Hope it helps you.

from reactify-django.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.