A Django-based microservice for providing weather data using PostgreSQL. This service is part of a larger distributed application.
- Docker and Docker Compose
- Python 3.9+ (if running locally)
- PostgresSQL database
TO-DO
- Run the Container
docker run --env-file .env -p 8000:8000 weather-api-django
- Clone the repository:
git clone https://github.com/rushxpush/weather-api-django.git
- Create a virtual environment and activate it:
# Linux
source venv/bin/activate
# Windows
venv/Scripts/activate # I need to check this
- Install dependencies
pip install -r requirements.txt
- Apply migrations
python manage.py migrate
- Run the development server
python manage.py runserver
Create a '.env' file in the project root with the following variables:
DEBUG=True POSTGRES_USERNAME=<YOUR_DATABASE_USERNAME> POSTGRES_PASSWORD=<YOUR_DATABASE_PASSWORD> POSTGRES_PORT=5430 POSTGRES_HOST=localhost
weather_project/
: The main Django project containing settings and configurations.weather_api/
: The Django app containing the API logic and models.
- Run the development server:
python manage.py runserver
- Create a new migration:
python manage.py makemigrations
- Apply migrations:
python manage.py migrate
- Run tests:
python manage.py test