This web project is built using Django, allowing users to send SMS messages through the Twilio service. It includes HTML form endpoints for user input and a REST API endpoint for JSON requests.
-
Clone the repository:
git clone https://github.com/YuliaHladyshkevych/SMService cd sms_service
-
If you are using PyCharm - it may propose you automatically create venv for your project and install requirements in it, but if not:
python -m venv venv venv\Scripts\activate (on Windows) source venv/bin/activate (on macOS)
-
You can open the project in IDE and configure .env file using .env.sample file as an example.
-
Install dependencies:
pip install -r requirements.txt
-
Apply database migrations:
python manage.py migrate
-
Start the development server:
python manage.py runserver
/home/ GET
Access the home page with an HTML form for phone number and message input.
/send-sms/ POST
Handles the HTML form submission from /home/
and sends an SMS using Twilio.
/api/v1/send-sms/ POST
Accepts JSON requests with the following structure:
{
"phone": "<some phone>",
"message": "<some message>"
}
Sends an SMS to the specified phone number with the provided message.
All sent SMS messages are logged in the logs
file.
Feel free to explore and modify the project according to your needs.