Transferring a Django + React Project to a New PC in an Offline Environment Without Reinstalling Dependencies

I have a full-stack Django and React project that I need to transfer to a new computer in a completely offline environment. My current setup includes:

  • Django backend with custom app
  • React frontend
  • Virtual environment
  • Specific dependency requirements

Project Structure:

development/
├── .git/
├── .gitignore
├── backend/
│   ├── app/
│   ├── db/
│   ├── manage.py
│   └── myproject/
├── frontend/
│   ├── node_modules/
│   ├── package.json
│   ├── package-lock.json
│   ├── public/
│   └── src/
├── initial_data.py
├── packages/
├── README.md
├── requirements.txt
└── venv/

Challenges

Dependency Management

  • No internet access for pip or npm install
  • Potential system-specific binary incompatibilities
  • Preserving exact package versions

Environment Reproduction

  • Virtual environment setup
  • Python and Node.js version compatibility
  • Native library dependencies

Current Attempts

I've tried:

  • Directly copying the entire project directory

  • Manually installing requirements from requirements.txt

  • Using pip and npm to install packages

Invariably, these methods fail due to:

  • Missing system libraries

  • Version conflicts

  • Binary incompatibility

Specific Questions

  • How can I package all project dependencies for offline transfer?
  • What's the most reliable method to reproduce the development environment?
  • Are there tools that can create a complete, transferable project snapshot?

Detailed Environment Details

  • Backend: Django 5.0.6

  • Frontend: React (based on package.json)

  • Python: 3.12.4

  • Operating System: Windows 11

Proposed Solutions Attempted

  • PyInstaller for creating a standalone executable
  • Manual virtual environment transfer
  • Comprehensive requirements and package files

Ideal Solution Requirements

  • Zero-configuration setup on the new computer

  • Preservation of exact dependency versions

  • Support for offline environment

  • Minimal manual intervention

Bonus Points: A script or method that can:

  • Validate environment compatibility

  • Automatically set up dependencies

  • Handle system-specific variations

Code/Configuration Snippets

requirements.txt:

altgraph==0.17.4
asgiref==3.8.1
Django==5.0.6
django-cors-headers==4.4.0
djangorestframework==3.15.2
djangorestframework-simplejwt==5.3.1
MouseInfo==0.1.3
packaging==24.1
pefile==2023.2.7
pillow==10.4.0
PyAutoGUI==0.9.54
PyGetWindow==0.0.9
pyinstaller==6.10.0
pyinstaller-hooks-contrib==2024.8
PyJWT==2.8.0
PyMsgBox==1.0.9
pyperclip==1.9.0
PyRect==0.2.0
PyScreeze==1.0.1
pytweening==1.2.0
pywin32-ctypes==0.2.3
setuptools==72.2.0
sqlparse==0.5.0
tk==0.1.0
tzdata==2024.1
wheel==0.45.1

package.json:

{
  "name": "frontend",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@emotion/react": "^11.11.4",
    "@emotion/styled": "^11.11.5",
    "@mui/icons-material": "^5.15.21",
    "@mui/material": "^5.15.21",
    "@testing-library/jest-dom": "^5.17.0",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "axios": "^1.7.2",
    "framer-motion": "^11.14.4",
    "react": "^18.3.1",
    "react-dom": "^18.3.1",
    "react-intersection-observer": "^9.14.0",
    "react-router-dom": "^6.24.0",
    "react-scripts": "5.0.1",
    "react-transition-group": "^4.4.5",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "proxy": "http://localhost:8000",
  "devDependencies": {
    "@babel/plugin-proposal-private-property-in-object": "^7.21.11"
  }
}

Constraints

  • No internet access in the new computer
  • Potential OS version differences (Doubtful)
  • Must maintain development workflow

Thanks in advance! 😊

Вернуться на верх