Django / Vite / UV problem

vincm1HOBBY

6 days ago

Hi everyone,

trying to deploy my Django app built with Vite for Frontend HMR.

When deploying the following problems occur:

Log Files:

[stage-0 10/15] RUN --mount=type=cache,id=s/633307fa-24ad-4579-88ca-de881219522a-/root/cache/pip,target=/root/.cache/pip python -m venv --copies /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt 2m 46s

vollendet :„2025-06-08T23:03:32.263825668Z“

Zusammenfassung :„sha256:8fb05770eb2062bde216e6ef7104ee62673a6718ecfc3111b3f5fd67c694010d“

Eingänge :[⋯]

Ebene :"Info"

Quelle :"Bausatz"

gestartet :„2025-06-08T23:00:46.238830978Z“

Typ :"Scheitel"

09. Juni 01:03:32

[stage-0 11/15] KOPIEREN . /app/.

Zusammenfassung :„sha256:13573cf668115e5992dfe7ef1bc747b08db34f9268b23c9b40d22f4fc73c51c8“

Eingänge :[⋯]

Ebene :"Info"

Quelle :"Bausatz"

gestartet :"2025-06-08T23:03:32.2660042Z"

Typ :"Scheitel"

09. Juni 01:03:35

[stage-0 11/15] KOPIE . /app/. 3s

vollendet :"2025-06-08T23:03:35.432642025Z"

Zusammenfassung :„sha256:13573cf668115e5992dfe7ef1bc747b08db34f9268b23c9b40d22f4fc73c51c8“

Eingänge :[⋯]

Ebene :"Info"

Quelle :"Bausatz"

gestartet :"2025-06-08T23:03:32.2660042Z"

Typ :"Scheitel"

09. Juni 01:03:35

[stage-0 12/15] RUN --mount=type=cache,id=s/633307fa-24ad-4579-88ca-de881219522a-node_modules/cache,target=/app/node_modules/.cache npm run build

Zusammenfassung :„sha256:1b09d010ec23fb4e0f1833dd452d386782a8f6f1e7b6a495a2015a6b55db5be6“

Eingänge :[⋯]

Ebene :"Info"

Quelle :"Bausatz"

gestartet :„2025-06-08T23:03:35.434898996Z“

Typ :"Scheitel"

09. Juni 01:03:35

npm warn config production Verwenden Sie stattdessen „--omit=dev“.

Ebene :"Info"

Quelle :"Bausatz"

Strom :2

Zeitstempel :„2025-06-08T23:03:35.659687263Z“

Typ :"Protokoll"

Scheitelpunkt :„sha256:1b09d010ec23fb4e0f1833dd452d386782a8f6f1e7b6a495a2015a6b55db5be6“

09. Juni 01:03:35

> schoolhomi@1.0.0 Build > Vite Build

Ebene :"Info"

Quelle :"Bausatz"

Strom :1

Zeitstempel :„2025-06-08T23:03:35.682317492Z“

Typ :"Protokoll"

Scheitelpunkt :„sha256:1b09d010ec23fb4e0f1833dd452d386782a8f6f1e7b6a495a2015a6b55db5be6“

09. Juni 01:03:35

sh: 1: vite: Zugriff verweigert

Ebene :"Info"

Quelle :"Bausatz"

Strom :2

Zeitstempel :„2025-06-08T23:03:35.687570074Z“

Typ :"Protokoll"

Scheitelpunkt :„sha256:1b09d010ec23fb4e0f1833dd452d386782a8f6f1e7b6a495a2015a6b55db5be6“

railway.json

{
  "$schema": "https://railway.com/railway.schema.json",
  "build": {
    "builder": "NIXPACKS",
    "nixpacksPlan": {
      "providers": [
        "...",
        "python"
      ]
    }
  },
  "deploy": {
    "runtime": "V2",
    "numReplicas": 1,
    "startCommand": "python manage.py migrate && python manage.py collectstatic --noinput && gunicorn -k gevent schoolhomi.wsgi:application",
    "sleepApplication": false,
    "multiRegionConfig": {
      "europe-west4-drams3a": {
        "numReplicas": 1
      }
    },
    "restartPolicyType": "ON_FAILURE",
    "restartPolicyMaxRetries": 10
  }
}

vite.config.json

import { defineConfig } from "vite";
import { resolve } from "path";
import tailwindcss from "@tailwindcss/vite";

export default defineConfig({
    base: "/static/",
    resolve: {
      alias: {
        '@': resolve('./static'),
      }
    },
    build: {
      manifest: true,
      outDir: resolve("./staticfiles/dist"),
      emptyOutDir: true,
      assetsDir: "",
      rollupOptions: {
        input: {
          main: resolve('./static/js/main.js')
        },
        output: {
          manualChunks: undefined,
          entryFileNames: `[name].js`,
          chunkFileNames: `[name].js`,
          assetFileNames: `[name].[ext]`
        }
      }
    },
    plugins: [
        tailwindcss(),
    ]
});

package.json

{
  "name": "schoolhomi",
  "version": "1.0.0",
  "description": "",
  "main": "vite.config.js",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "postinstall": "npm run build"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/vincm1/SchoolHomi.git"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "type": "commonjs",
  "bugs": {
    "url": "https://github.com/vincm1/SchoolHomi/issues"
  },
  "homepage": "https://github.com/vincm1/SchoolHomi#readme",
  "engines": {
    "node": ">=20.0.0",
    "npm": ">=10.0.0"
  },
  "dependencies": {
    "vite": "^6.2.2",
    "@tailwindcss/vite": "^4.0.14",
    "alpinejs": "^3.14.9",
    "flatpickr": "^4.6.13",
    "htmx-ext-ws": "^2.0.3",
    "htmx.org": "^2.0.4",
    "tailwindcss": "^4.0.14"
  }
}

UV pyproject.toml and uv.lock exist as well.

Thanks in advance!

$10 Bounty

1 Replies

alexwebgrHOBBY

3 days ago

Hi there

can post just the error message?

thanks

alex