TODO is a minimalistic task manager with built-in telegram notifications. Developed using Django and celery. Try it: http://todo.glitchdev.space
Preparing server and environment
git clone https://github.com/gl1tchdev/TODO
cd TODO
apt-get install redis postgresql libpq-dev
sudo -i -u postgres
psql
CREATE DATABASE todo;
exit
Create telegram bot and open file TODO/settings.py
:
set up environment variable TG_TOKEN
and save it
paste tg bot link to settings:
TELEGRAM_BOT_LINK = 'paste link here'
Change next lines too:
HOST_NAME = 'full address of application'
REDIS_URL = 'url of redis-server'
Check if postgresql connection data is correct in next lines
DATABASES = ...
Add your host to
ALLOWED_HOSTS = ...
Set up env vars PG_LOGIN
and PG_PASS
.
poetry install
poetry shell
python manage.py migrate
python manage.py collectstatic --noinput
- run polling for tg registration app:
python run_polling.py
- run celery app and redis-server for tg notifications:
redis-server
celery -A TODO worker -P eventlet
- run django app:
python manage.py runserver 8000
Check this source. Do: All daemons need these lines in systemd conf:
Environment="PG_LOGIN=..."
Environment="PG_PASS=..."
Environment="TG_TOKEN=..."
Environment="DJANGO_SETTINGS_MODULE=TODO.settings"
- Create todo daemon
...
ExecStart=/path/to/poetry run gunicorn --preload --bind unix:todo.sock TODO.wsgi:application -w 3
...
Start this daemon and enable. Check if todo.sock exists. 2. Create nginx conf
server {
listen ...
server_name ...
location / {
include proxy_params;
proxy_pass http://unix:/path/to/project/todo.sock;
}
location /static/ {
root /path/to/project;
}
}
systemctl restart nginx
- Check if redis server works. Create todo_celery daemon:
...
ExecStart=/path/to/poetry run celery -A TODO worker -P eventlet -l info
...
Start this daemon and enable.
- Create todo_bot daemon:
...
ExecStart=/path/to/poetry run python run_polling.py
...
Start this daemon and enable. Done!