Skip to content

theMirmakhmudov/Metsenat-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

46 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Image here

Metsenat-API

Metsenat-API GitHub repo size GitHub contributors GitHub last commit

Metsenat-API is a RESTful API designed for managing sponsorships and donations, facilitating transparent interactions between donors and recipients.

πŸ“Œ Features

  • User authentication and authorization
  • Sponsor and student management
  • Donation tracking and reporting
  • Secure and optimized API endpoints

πŸš€ Getting Started

Prerequisites

Ensure you have the following installed:

  • Python 3.9+
  • PostgreSQL (or any preferred database)
  • Docker (optional but recommended)

Installation (Windows, Linux, Mac)

  1. Clone the repository:

    git clone https://github.com/theMirmakhmudov/Metsenat-API.git
    cd Metsenat-API
  2. Create a virtual environment:

    • Windows
      python -m venv venv
      venv\Scripts\activate
    • Mac/Linux
      python3 -m venv venv
      source venv/bin/activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Configure environment variables:

    • Copy .env.example to .env
    • Update database and secret key values accordingly

Database Migration

Run the following commands to set up the database:

python manage.py makemigrations
python manage.py migrate
make mig

Running the Server

  • Windows, Mac, Linux:

    python manage.py runserver
    make run

πŸ“‚ Project Structure

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
Image here

πŸ›  API Endpoints

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/

πŸ— Deployment

Docker Setup (Optional)

  1. Build and run the container:
    docker-compose up --build -d
  2. Run database migrations:
    docker-compose exec web python manage.py migrate

Gunicorn & Nginx (Production)

  • Use Gunicorn for running the Django application.
  • Set up Nginx as a reverse proxy for handling requests efficiently.

πŸ›‘ Security Best Practices

  • Store sensitive credentials in environment variables.
  • Use Django's built-in security middleware.
  • Regularly update dependencies.

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a feature branch.
  3. Commit changes.
  4. Submit a pull request.

πŸ“œ License

This project is licensed under the MIT License.

πŸ“¬ Contact


Enjoy using Metsenat-API! πŸŽ‰

Releases

No releases published

Packages

 
 
 

Contributors