Here’s a detailed commit message based on the provided diff:
Commit Message: feat: Implement web calendar application with Flask, Docker, and calendar integration Description: 1. Server Refactor: • Moved application logic from main.py to a structured directory server/app/. • Added server/app/__init__.py for Flask app initialization. • Introduced server/app/views.py to handle routes (dashboard and dashboard_image). • Created server/app/models.py for event modeling, supporting CalDAV and iCalendar events. • Added server/app/weather.py to fetch weather data using OpenWeatherMap API. 2. New Features: • Added an image generation route (/image) to render calendar views as BMP images. • Integrated OpenWeatherMap API for weather data on the dashboard. 3. Environment and Configurations: • Added a Dockerfile to build and deploy the app using uwsgi-nginx-flask. • Introduced compose.yml for running the app with Docker Compose. • Moved uwsgi.ini configuration to server/uwsgi.ini for modular organization. 4. Dependencies: • Updated requirements.txt to include new dependencies: imgkit, pillow, and Werkzeug==2.2.2. 5. Static Assets: • Added placeholder images out.png and test.png. 6. Code Cleanup: • Removed old files (main.py and root-level uwsgi.ini). • Updated .gitignore to include .idea/ folder. Additional Notes: • Enhanced event parsing to handle all-day and time-specific events using server/app/models.py. • Utilized Flask’s render_template for dynamic HTML rendering and imgkit for HTML-to-image conversion. • Integrated multiple calendar sources (CalDAV and public iCal feeds). Let me know if you need further adjustments!
This commit is contained in:
16
server/app/weather.py
Normal file
16
server/app/weather.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import json
|
||||
import requests
|
||||
import os
|
||||
|
||||
#based on
|
||||
URL = "https://worldweather.wmo.int/en/json/{city_id}_en.json"
|
||||
URL = "https://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={api_key}"
|
||||
|
||||
|
||||
def weather(api_key=os.getenv('openweathermap_api_key'), lat="41.98", lon="-87.90"):
|
||||
url = URL.format(api_key=api_key, lat=lat, lon=lon)
|
||||
data = json.loads(requests.get(url).content)
|
||||
return data['weather'][0]
|
||||
|
||||
# f=weather()
|
||||
pass
|
||||
Reference in New Issue
Block a user