Skip to content

Kari230996/blogbot_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📝 MyBlogBot — Telegram Bot + Django API

A Telegram bot connected to a REST API built with Django. Features include:

  • Viewing posts
  • Adding, editing, and deleting posts
  • Authentication via login/password

🚀 Quick Start

1. Clone the project and enter the directory

git clone https://github.com/your-username/blogbot_project.git
cd blogbot_project

2. Install dependencies

python -m venv venv
source venv/bin/activate  # on Windows: venv\Scripts\activate
pip install -r requirements.txt

3. Configure environment variables

Rename .env.example to .env:

mv .env.example .env  # or rename manually in Explorer

Then insert your Telegram token from @BotFather into the BOT_TOKEN field.


⚙️ Run Django API

python manage.py migrate
python manage.py createsuperuser
python manage.py runserver

🤖 Run the Telegram Bot

In a separate terminal:

python bot/main.py

⚠️ Important: The Django server and the bot must be running simultaneously in different terminal windows.


🧠 Bot Commands

Command Description
/start Welcome message
/login Authentication (username + password)
/posts List all posts
/add Add a post (after authentication)
/edit <id> Edit a post
/delete <id> Delete a post

🔗 Main API Endpoints

All routes are prefixed with /api/.

Method Endpoint Description
POST /api/login Obtain an authentication token
GET /api/posts Get all posts
GET /api/posts/<id> Get a single post by ID
POST /api/posts Create a post (requires token)
PUT /api/posts/<id> Update a post (requires token)
DELETE /api/posts/<id> Delete a post (requires token)

📘 Documentation available at: /api/docs


📅 Contact

karina.apaeva96@gmail.com

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages