protibimbok / django-vite-plugin

This plugin configures Vite for use with Django backend.
103 stars 13 forks source link

npm run dev does not work #11

Closed ibooj closed 1 year ago

ibooj commented 1 year ago

Hello! I use pyenv. It seems that djangoVite does not see the python

> frontend@0.0.0 dev
> vite

pyenv: python: command not found

The `python' command exists in these Python versions:
  3.7.8
  3.9.13
  3.9.15
  3.10.4
  3.10.8

Note: See 'pyenv help global' for tips on allowing both
      python2 and python3 to be found.

How to fix?

protibimbok commented 1 year ago

Configure your vite.config.js file to point at the right python executable (The one you use to run manage.py commands).

export default defineConfig({
    plugins: [
        //Other plugins
        djangoVite({
            // Other options
            pyPath: './path/to/python' // `python3` or 'py' should do the job.
        })
    ],
});