Django is a great web application framework “for perfectionists with deadlines”.
A dApp is an app running on the blockchain: a smart contract on which users can call functions on.
This module provides blockchain support for Django, for reading and/or writing the blockchain, with the following features usable independently:
private key vault
blockchain data normalization
multiple blockchain support (tezos & ethereum so far)
inter-blockchain contract synchronisation
metamask authentication backend (TBA)
In addition to these features, djWebdApp differenciates itself from indexers like dipdup because it is extensible: it’s just a module you add to your Django project like any other Django App, in which you can add models, endpoints, and have an admin interface for free, and so on, benefiting from the vast Django ecosystem of apps.
If you are not familiar with the Django development framework, it is recommended you follow their tutorial first, even though you can go through this tutorial copy/pasting your way.
You may use the demo project or create your own and install djwebdapp there.
To install djwebdapp with all optional dependencies:
pip install djwebdapp[all][binary]
[binary] right there if you prefer to install compiled python
packages from your system package manager.
See setup.py’s extra_requires for other possibilities.
For this tutorial, we’ll use the
git clone https://yourlabs.io/oss/djwebdapp.git cd djwebdapp pip install --editable .[all][binary] ./manage.py migrate ./manage.py shell
Instead of using mainnets for development, we’re going to use a local blockchains, so that we can work completely locally.
We provide a
docker-compose.yml in the root directory of this repository,
docker-compose up to start it.
As some of us will also want to convert this to GitLab-CI
services, we’ll refer to our services
by hostname from now on, which is why we add the following to
127.0.0.1 tzlocal ethlocal
You should then have:
a local ethereum HTTP RPC API on
ethlocal:8545with a WebSocket on
a local tezos sandbox on
tzlocal:8732which autobakes every second, useable like geth development mode.
See documentation for Example contract deployment in each blockchain specific documentation pages for more pointers.
Instead of the demo project, you can also create your own project, instead of the first step of cloning do:
django-admin startproject your_project_name
your_project_name/your_project_name/settings.py, add to
'djwebdapp', 'djwebdapp_tezos', 'djwebdapp_ethereum'… See
djwebdapp_demo/settings.pyfor other INSTALLED_APPS you can use
proceed with the next steps
Read documentation online or in the
- djWebdApp Tezos
- Indexing contracts
- djWebdApp Ethereum
- Indexing contracts
- djWebdApp Examples