Metsenat-API is a RESTful API designed for managing sponsorships and donations, facilitating transparent interactions between donors and recipients.
- User authentication and authorization
- Sponsor and student management
- Donation tracking and reporting
- Secure and optimized API endpoints
Ensure you have the following installed:
- Python 3.9+
- PostgreSQL (or any preferred database)
- Docker (optional but recommended)
-
Clone the repository:
git clone https://github.com/theMirmakhmudov/Metsenat-API.git cd Metsenat-API -
Create a virtual environment:
- Windows
python -m venv venv venv\Scripts\activate
- Mac/Linux
python3 -m venv venv source venv/bin/activate
- Windows
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables:
- Copy
.env.exampleto.env - Update database and secret key values accordingly
- Copy
Run the following commands to set up the database:
python manage.py makemigrations
python manage.py migratemake mig-
Windows, Mac, Linux:
python manage.py runserver
make run
Metsenat-API/
βββ manage.py # Django management script
βββ .env.example # Environment variables example
βββ requirements.txt # Python dependencies
βββ Dockerfile # Docker configuration
βββ docker-compose.yml # Docker Compose setup
βββ config/ # Project configuration files
β βββ settings.py # Django settings
β βββ urls.py # URL routing
βββ api/ # Main API application
β βββ admin.py # Admin configuration
β βββ apps.py # App configuration
β βββ managers.py # Custom model managers
β βββ models.py # Database models
β βββ serializers.py # API serializers
β βββ tests.py # Unit tests
β βββ urls.py # API routes
β βββ views.py # API views
βββ docs/ # API documentation
βββ media/ # Uploaded media files
β βββ avatar/
β βββ student/
β βββ default-student.webp
βββ Metsenat/ # Core project settings
β βββ asgi.py # ASGI configuration
β βββ settings.py # Project settings
β βββ urls.py # Root URL configuration
β βββ wsgi.py # WSGI configuration
βββ LICENSE # Project license
βββ README.md # Project documentation
βββ Makefile # Automation scripts
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/sponsors/ |
List sponsors |
| POST | /api/sponsors/ |
Create a sponsor |
| GET | /api/students/ |
List students |
| POST | /api/students/ |
Register a student |
π Full API documentation is available via Swagger UI at:
http://localhost:8000/api/docs/- Build and run the container:
docker-compose up --build -d
- Run database migrations:
docker-compose exec web python manage.py migrate
- Use Gunicorn for running the Django application.
- Set up Nginx as a reverse proxy for handling requests efficiently.
- Store sensitive credentials in environment variables.
- Use Django's built-in security middleware.
- Regularly update dependencies.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a feature branch.
- Commit changes.
- Submit a pull request.
This project is licensed under the MIT License.
- Author: theMirmakhmudov
- Email: mr.mirmakhmudov16112008@gmail.com
Enjoy using Metsenat-API! π