datastar/examples/python/django
Chase Sterling 16fa3cdd90
Python SDK: change `merge_fragments` to take a string rather than list (#822)
* python sdk: change merge_fragments to take a string rather than list

* Change merge_fragments for fasthtml to accept a string rather than list
2025-04-11 13:01:09 -06:00
..
datastar Fix WSGI/ASGI issues in Django Example Project (#787) 2025-03-28 19:49:13 -06:00
ds Python SDK: change `merge_fragments` to take a string rather than list (#822) 2025-04-11 13:01:09 -06:00
README.md Fix WSGI/ASGI issues in Django Example Project (#787) 2025-03-28 19:49:13 -06:00
db.sqlite3 SDK for python (#250) 2025-01-05 10:35:33 -06:00
manage.py SDK for python (#250) 2025-01-05 10:35:33 -06:00
pyproject.toml Fix WSGI/ASGI issues in Django Example Project (#787) 2025-03-28 19:49:13 -06:00

README.md

Datastar Django

ASGI and WSGI examples of Datastar and Django in action.

To take full advantage of Datastar, we recommend (but do not require) that you use ASGI, especially on green field projects to take advantage of the full range of Datastar's capabilities. That said, Datastar and Django will work perfectly well over WSGI.

ASGI (default)

Install the dependencies, start runserver as usual, and go to http://127.0.0.1/ to see the demo.

💡 Note: Because Django's runserver is WSGI only, we use Daphne's built-in ASGI runserver.

WSGI

While, Datastar works great in a WSGI context, we recommend you give ASGI a try if possible (see top of this page for more details).

To use WSGI make sure runserver is stopped and make the following changes to the settings file in the datastar project directory:

  1. Uncomment the WSGI_APP setting, and comment out the ASGI_APP setting.

  2. In INSTALLED_APPS comment out "daphne",

  3. Start runserver and go to http://127.0.0.1/wsgi/ and watch the demo.