Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation


📍How to install:

📮Connect to Postman:


1.1 Import `Postman Collections`folder into Postman

1.2 Set the environment settings `Weather.postman_environment`

1.3 The `E_Shop_API.postman_collection` collection contains requests

1.4 In your terminal, enter the following command:

ssh -R 80:localhost:8000 serveo.net

Copy the forwarding message:

Forwarding HTTP traffic from https://your_host.serveo.net

1.5 Also set localhost in Postman:

http://localhost:8000/

🐳Connect to Docker Compose:


2.1 Create Your .env and set correct values:

cd backend/
echo "Creating .env file..."
cat <<EOL > .env
# Django configuration
SECRET_KEY=YOUR_SECRET_KEY
DEBUG=1

# PostgreSQL (docker/local)
DB_ENGINE=django.db.backends.postgresql_psycopg2
POSTGRES_DB=weather_db
POSTGRES_USER=postgres
POSTGRES_PASSWORD=example
DB_PORT=5432

# pgadmin container
PGADMIN_DEFAULT_EMAIL=admin@gmail.com
PGADMIN_DEFAULT_PASSWORD=root

# OPENWEATHERMA
OPENWEATHERMAP_URL=http://api.openweathermap.org/data/2.5/forecast
# OPENWEATHERMA API key (test)
OPENWEATHERMAP_API_KEY=5b44ac6286917292ea1dc572affc3aff
EOL
cd ..

2.2 UP Docker-compose:

docker-compose -f docker/docker-compose.yml up --build

2.3 Login to the container console:

docker exec -it django-container bash

2.3 Login to the container console:

python3 manage.py createsuperuser

2.4 Localhost Database Setup:

Create a database on localhost:5050
  • Open localhost:5050 in your browser.
  • Register the server.
  • In the connection settings:
    • Host: postgres-container
    • Username: postgres
    • Password: your_password

Endpoints

Authentication Endpoints

  • POST /api/token/: Log in and receive a JWT token.
  • POST /api/token/refresh/: Refresh the JWT token.

User Management Endpoints

  • POST /api/create_user/: Create a new user.
  • GET/PUT/DELETE /api/users/<user_id>/: CRUD operations for a specific user.
  • GET /api/users/: Retrieve a list of all users.

Weather Endpoints

  • GET /api/weather/current/: Get the current weather at your location.
  • GET /api/weather/search/: Get the current weather for a specified location.
  • GET /api/weather/forecast/: Get a 7-day weather forecast for a specified location.
  • GET /api/weather/current_forecast/: Get a 7-day weather forecast for your current location.

About

🌦️ Weather_API is a delightful project that provides real-time and forecasted weather information with a user-friendly API. From fetching current conditions to 7-day forecasts! 🌍🔮

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages