Real-time ob-havo ma'lumotlari va havo sifatini kuzatish ilovasi
π Live Demo: https://shamshod-weather.up.railway.app
- Xususiyatlari
- Demo
- Texnologiyalar
- Lokal O'rnatish
- Railway Deploy
- API Konfiguratsiya
- Loyiha Strukturasi
- Xavfsizlik
- Contributing
- Litsenziya
- Real-time harorat va his etilgan harorat
- Shamol tezligi va yo'nalishi
- Namlik va atmosfera bosimi
- Osmon holati (bulutlilik, yomg'ir, qor va h.k.)
- Mahalliy vaqt (timezone-aware)
- Air Quality Index (AQI) real-time
- PM2.5 va PM10 zarralar miqdori
- CO, NOβ, Oβ, SOβ gazlar konsentratsiyasi
- Niqob tavsiyalari AQI asosida
- Rang kodlangan xavf darajalari
- Kunlik minimal/maksimal harorat
- O'rtacha namlik
- Ob-havo tavsifi (o'zbekcha)
- Kun nomlari (o'zbekcha)
- Ikonali vizual ko'rinish
- Responsive dizayn (mobile, tablet, desktop)
- Bootstrap 5 UI framework
- Real-time shahar qidiruv
- Session-based shahar eslab qolish
- Xatoliklarni qulay ko'rsatish
Joriy Ob-havo Sahifasi
π https://shamshod-weather.up.railway.app/
Havo Ifloslanish
π https://shamshod-weather.up.railway.app/pollution/
5 Kunlik Prognoz
π https://shamshod-weather.up.railway.app/forecast/
- Django 5.2.7 - Python web framework
- Gunicorn - WSGI HTTP server (production)
- Requests - HTTP library for API calls
- dj-database-url - Database configuration
- Bootstrap 5 - CSS framework
- Django Templates - Server-side rendering
- Font Awesome - Icons
- SQLite - Local development
- PostgreSQL - Production (Railway optional)
- Cookie-based Sessions - Railway-compatible
- OpenWeather API - Weather data provider
- Current Weather API
- Air Pollution API
- 5 Day Forecast API
- Geocoding API
- Railway.app - Cloud platform
- WhiteNoise - Static files serving
- GitHub - Version control
- Python 3.12 yoki yuqori
- pip (Python package manager)
- Git
git clone https://github.com/shamshodbekdevops/weather_app.git
cd weather_appWindows:
python -m venv venv
venv\Scripts\activatemacOS/Linux:
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txt.env fayli yaratish (yoki mavjud fayldagi qiymatlarni o'zgartirish):
# Django Settings
SECRET_KEY=django-insecure-your-secret-key-here
DEBUG=True
# OpenWeather API
OPENWEATHER_API_KEY=your_api_key_here
# Allowed Hosts
ALLOWED_HOSTS=127.0.0.1,localhost
β οΈ Eslatma:.envfayli.gitignore'da β hech qachon commit qilmang!
python manage.py migratepython manage.py collectstatic --noinputpython manage.py runserverπ± Brauzerda: http://127.0.0.1:8000
1οΈβ£ GitHub Repository Push:
git add .
git commit -m "Ready for deployment"
git push origin main2οΈβ£ Railway Setup:
- railway.app ga o'ting
- GitHub bilan login qiling
- "New Project" β "Deploy from GitHub repo"
- Repository tanlang:
weather_app
3οΈβ£ Environment Variables:
Railway Dashboard β Variables:
| Variable | Value |
|---|---|
SECRET_KEY |
Yangi secure key (generator) |
OPENWEATHER_API_KEY |
OpenWeather API key |
DEBUG |
False |
RAILWAY_PUBLIC_DOMAIN |
shamshod-weather.up.railway.app |
π‘ SECRET_KEY generatsiya qilish:
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
4οΈβ£ Deploy!
- Railway avtomatik build va deploy qiladi
- Logs'ni kuzating
- App URL'ni oching
Railway β Add Service β PostgreSQL
DATABASE_URLavtomatik sozlanadi- Redeploy qiling
- OpenWeatherMap ga o'ting
- Account yarating (bepul)
- API Keys bo'limiga o'ting
- Default API key'ni ko'ching
.envfaylga qo'ying:OPENWEATHER_API_KEY=your_api_key_here
- β 60 calls/minute
- β 1,000,000 calls/month
- β Current weather
- β 5 day forecast
- β Air pollution data
WeatherAPPNew/
βββ π core/ # Django proyekt sozlamalari
β βββ settings.py # Asosiy konfiguratsiya
β βββ urls.py # URL routing
β βββ wsgi.py # WSGI entry point
β βββ asgi.py # ASGI entry point
β
βββ π weather/ # Weather application
β βββ views.py # Business logic
β βββ urls.py # App URL patterns
β βββ models.py # Database models
β βββ admin.py # Admin panel config
β βββ migrations/ # Database migrations
β
βββ π templates/ # HTML templates
β βββ base.html # Base template
β βββ current_weather.html # Current weather view
β βββ air_pollution.html # Air pollution view
β βββ five_day_forecast.html # Forecast view
β
βββ π static/ # Static files (auto-created)
β βββ (CSS, JS, images)
β
βββ π staticfiles/ # Collected static files (production)
β
βββ π manage.py # Django CLI
βββ π requirements.txt # Python dependencies
βββ π Procfile # Railway deployment config
βββ π runtime.txt # Python version specification
βββ π .env # Environment variables (local)
βββ π .gitignore # Git ignore patterns
βββ π db.sqlite3 # SQLite database (local)
βββ π README.md # Documentation (shu fayl)
# Django Core
SECRET_KEY=django-insecure-your-secret-key-here
DEBUG=True
# OpenWeather API
OPENWEATHER_API_KEY=your_openweather_api_key
# Network
ALLOWED_HOSTS=127.0.0.1,localhost| Variable | Tavsif | Misol |
|---|---|---|
SECRET_KEY |
Django secret key (50+ belgi) | django-insecure-abc123... |
OPENWEATHER_API_KEY |
OpenWeather API key | 259afab76ef42e09f45... |
DEBUG |
Debug mode (FALSE!) | False |
RAILWAY_PUBLIC_DOMAIN |
Railway public domain | shamshod-weather.up.railway.app |
DATABASE_URL |
PostgreSQL URL (ixtiyoriy) | postgresql://user:pass@... |
Sabab: Dependencies o'rnatilmagan
Yechim:
pip install -r requirements.txtSabab: Static files yig'ilmagan
Yechim:
python manage.py collectstatic --noinput --clearSabab: Railway domeni trusted origins'da yo'q
Yechim: Railway Variables'da qo'shing:
RAILWAY_PUBLIC_DOMAIN=shamshod-weather.up.railway.app
Sabab: OpenWeather API key noto'g'ri yoki faol emas
Yechim:
- OpenWeatherMap ga o'ting
- API key'ni tekshiring (faol bo'lishi kerak)
- Railway Variables'da yangilash
- Redeploy qiling
Sabab: Server xatosi (settings, database, yoki kod xatosi)
Yechim:
- Railway Logs'ni tekshiring:
Deployments β Logs DEBUG=True(faqat test uchun!) qilib xatoni ko'ring- Error traceback asosida tuzatish
Sabab: Migrations o'tkazilmagan
Yechim:
# Local
python manage.py migrate
# Railway (avtomatik - Procfile'da)
# Agar ishlamasa, Railway console'dan:
python manage.py migrate --noinput-
DEBUG = Falseproduction'da -
SECRET_KEYyangi va uzoq (50+ belgi) -
.envfayling.gitignore'da - HTTPS (Railway avtomatik)
- CSRF protection enabled
- ALLOWED_HOSTS to'g'ri sozlangan
- Secure cookies (production'da)
- HSTS headers enabled
β οΈ Hech qachon API key'ni GitHub'ga commit qilmang- β Environment variables ishlatish
- β
.envfayling.gitignore'da - β Railway'da Variables orqali sozlash
- β OpenWeather free plan cheklovlarini bilish (60 req/min)
| Metric | Limit |
|---|---|
| Calls/Minute | 60 |
| Calls/Month | 1,000,000 |
| Response Time | ~200-500ms |
| Data Update | Har 10 daqiqa |
| Resource | Limit |
|---|---|
| RAM | 512MB (default) |
| CPU | Shared |
| Bandwidth | 100GB/month |
| Deploy Time | ~2-5 daqiqa |
# 1. Lokal o'zgarishlar
git add .
git commit -m "Feature: yangi funksiya"
# 2. GitHub'ga push
git push origin main
# 3. Railway avtomatik deploy qiladi
# Logs'ni kuzatish: Railway Dashboard β Deployments# Dependencies'ni tekshirish
pip list --outdated
# Ma'lum paketni yangilash
pip install --upgrade django
# requirements.txt yangilash
pip freeze > requirements.txtLoyihaga hissa qo'shishni xohlaysizmi? Xush kelibsiz!
- Fork qiling
- Feature branch yarating (
git checkout -b feature/YangiFunksiya) - Commit qiling (
git commit -m 'Add: Yangi funksiya') - Push qiling (
git push origin feature/YangiFunksiya) - Pull Request oching
- Python: PEP 8
- Django: Django Style Guide
- Comments: O'zbekcha yoki Inglizcha
- Naming: Snake_case (Python), kebab-case (HTML/CSS)
- User authentication & profiles
- Sevimli shaharlar ro'yxati
- Email/SMS xabarnomalar (haddan tashqari AQI)
- Historical weather data charts
- Multi-language support (πΊπΏ π¬π§ π·πΊ)
- PWA (Progressive Web App)
- Dark mode theme
- Weather alerts & warnings
- UV Index tracking
- Hourly forecast (24 soatlik)
Developer: Shamshodbek
GitHub: @shamshodbekdevops
Project: weather_app
Live Demo: shamshod-weather.up.railway.app
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2026 Shamshodbek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- OpenWeatherMap - Bepul weather API uchun
- Railway - Oson deployment uchun
- Django Community - Ajoyib framework uchun
- Bootstrap Team - Responsive UI uchun
Agar bu loyiha sizga yoqsa, β star bosishni unutmang!
Made with β€οΈ in Uzbekistan πΊπΏ
π Live Demo β’ π Documentation β’ π Report Bug β’ β¨ Request Feature