A very simple django project that helps understanding some concepts about the Django Q implementation. It uses a telegram API to create Clients and make subscriptions via a task management system.
Report Bug
**·**
Request Feature
This is a very simple Django to demonstrate how to implement the task manager and scheduler Django Q.
This application also uses the Telegram API to provide an interacting interface with users.
The main logic behind this application is to register a Client
into the database, using information from the telegram
context. To register, the person must use the command /register <provided cpf numbers>
passing in a valid CPF. This
will create a Client
into the database with a pending cpf validation status.
The CPF will be validated using a Django Q Task
, that is also created with the Client
.
This task, will request the 4devs API sending the registered client CPF and return a message to the user via telegram
informing the CPF validation status.
A registered Client
can also subscribe to receive an hourly message containing an activity from the bored API.
This is managed via a Django Q hourly Scheduler
, that will request the bored API for a new activity
To get a local copy up and running follow these simple steps.
This project needs a valid telegram token to run successfully. For that you can access the telegram bots documentation.
To run this project you must either run it using docker, or use python version 3.9.5 in your local environment.
If you are running locally, you must also provide a PostgreSQL database!
- Running with
docker
docker-compose up --build app
- Running locally
pip install poetry poetry install bash scripts/start.sh
After cloning the repository you need to start the application.
To do that, you need to run the start.sh
script.
If you used docker-compose, when using
docker-compose up --build app
the command will already run the start script
The application interface is on the telegram app.
-
Add the
@myscheduler_django_bot
in the telegram app. -
Use the
/register <cpf>
command passing in a CPF number in the<cpf>
field.Ex.:
/register 12345678910
-
Subscribe to receive an hourly message with the
/subscribe
command. For this to work you must have a used a register command. -
To unsubscribe simply use the
/unsubscribe
command -
To unregister, simple use the
/unregister
command.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/my_awesome_feature
) - Commit your Changes (
git commit -m 'feat: adds some Amazing Feature'
) - Push to the Branch (
git push origin feature/my_awesome_feature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Alexandre Xavier - [email protected]
Project Link: https://github.com/abxsantos/my-djangoq-scheduler