Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ramiboutas/django-toots

An app to manage toots (Mastodon posts) in a Django project
https://github.com/ramiboutas/django-toots

api django django-app django-application django-apps mastodon mastodon-api mastodon-client python python3 toot

Last synced: 5 days ago
JSON representation

An app to manage toots (Mastodon posts) in a Django project

Awesome Lists containing this project

README

        

# django-toots

Create and delete toots in a Django project.

This package takes advantage of the [Mastodon.py](https://pypi.org/project/Mastodon.py/) functionalities to connect it to a Django Backend.

## Set up

1. Install from PyPI
```
python -m pip install django-toots
```

2. Add the package to your settings INSTALLED_APPS

```python

INSTALLED_APPS = [
...
"django_toots",
...
]

```

3. Add the following settings to your Django project.

Example:

```python
import os
from dotenv import load_dotenv
load_dotenv()

...

# django-toots
MASTODON_ACCESS_TOKEN=os.environ.get("MASTODON_ACCESS_TOKEN", "")
MASTODON_API_BASE_URL = "https://fosstodon.org"

```

4. Run migrations

```
python manage.py migrate

```

## Usage

TODO: Document this!

### Create a simple toot

```python

from django_toots.models import Toot

# create a toot in the db
t = Toot.objects.create(text="Hi, this is my toot using django-toots and Mastodon.py")

# publish it
t.publish()

```