Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/ramiboutas/django-toots
- Owner: ramiboutas
- License: mit
- Created: 2023-09-09T21:57:45.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-11T21:06:41.000Z (about 1 year ago)
- Last Synced: 2024-10-12T07:22:07.896Z (about 1 month ago)
- Topics: api, django, django-app, django-application, django-apps, mastodon, mastodon-api, mastodon-client, python, python3, toot
- Language: Python
- Homepage: https://pypi.org/project/django-toots/
- Size: 6.35 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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()```