chetan2710/Local_Medicine
0
Local Medicine Backend API
Django REST API for the Local Medicine mobile application - helping users find medicines and nearby pharmacies.
Features
- ๐ Authentication: JWT-based user authentication
- ๐ Medicine Management: Search and manage medicine inventory
- ๐ช Store Locations: Find nearby pharmacies and medicine stores
- ๐ฆ Inventory Tracking: Real-time inventory management
- ๐ Request Handling: Customer and shop request management
API Endpoints
Authentication
POST /api/v1/auth/register- Register new userPOST /api/v1/auth/login- User loginPOST /api/v1/auth/refresh- Refresh JWT tokenGET /api/v1/auth/me- Get current user info
Medicines
GET /api/v1/medicines/- List all medicinesGET /api/v1/medicines/search?q=query- Search medicinesGET /api/v1/medicines/{id}/- Get medicine detailsPOST /api/v1/medicines/- Create medicine (admin)PUT /api/v1/medicines/{id}/- Update medicine (admin)DELETE /api/v1/medicines/{id}/- Delete medicine (admin)
Stores
GET /api/v1/stores/- List all storesGET /api/v1/stores/nearby?lat={lat}&lng={lng}- Find nearby storesGET /api/v1/stores/{id}/- Get store detailsPOST /api/v1/stores/- Create store (shop owner)
Inventory
GET /api/v1/inventory/- List inventory itemsPOST /api/v1/inventory/- Add inventory itemPUT /api/v1/inventory/{id}/- Update inventoryDELETE /api/v1/inventory/{id}/- Remove inventory
Requests
GET /api/v1/requests/- List requestsPOST /api/v1/requests/- Create requestPUT /api/v1/requests/{id}/- Update request status
Technology Stack
- Framework: Django 4.2
- API: Django REST Framework
- Authentication: JWT (Simple JWT)
- Database: SQLite (development), PostgreSQL recommended for production
- Server: Gunicorn
- Static Files: Whitenoise
Environment Variables
See .env.example for required configuration variables.
Local Development
# Install dependencies
pip install -r requirements.txt
# Run migrations
python manage.py migrate
# Create superuser (admin)
python manage.py createsuperuser
# Run development server
python manage.py runserverProduction Deployment
This project is configured for deployment on Hugging Face Spaces using Docker.
Environment Variables to Set in Hugging Face:
SECRET_KEY- Django secret key (generate a secure one)ALLOWED_HOSTS- Your domain (e.g.,.hf.space)CORS_ALLOWED_ORIGINS- Your Flutter app URLsDEBUG- Set toFalsein production
License
MIT License - See LICENSE file for details
Support
For issues and feature requests, please open an issue on GitHub.
