#๐Ÿ”’ How do I use Django-Vite?

4 messages ยท Page 1 of 1 (latest)

torpid cove
#

I followed this tutorial on setting up svelte with django plus django-vite. https://www.rbd-solutions.com/blog/svelte-django/ Now I have the svelte part of the app running on port 5173, and the django app running on port 8000 with {% load django_vite %} and {% vite_hmr_client %} {% vite_asset 'main.ts' %} on the template not throwing any errors.

I am not sure if I did this right. Should it be running on both ports like that? When I add something to the template, it does not hot reload and I have to reload localhost:8000 to see the changes. Does that mean {% vite_hmr_client %} is not working?

Here is my index.html which runs on port 8000. It is just a blank page with Test on it. No svelte app is showing.

{% load django_vite %}

  

<!DOCTYPE html>

<html lang="en">

<head>

{% vite_hmr_client %}

{% vite_asset 'main.ts' %}

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Working Page</title>

</head>

<body>

<div id="app"></div>

Test

</body>

</html>
unborn abyssBOT
#

@torpid cove

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

unborn abyssBOT
#

@torpid cove

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.