-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
35 lines (29 loc) · 835 Bytes
/
Copy pathapp.py
File metadata and controls
35 lines (29 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from flask import Flask, jsonify
import logging
from datetime import datetime
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[
logging.FileHandler('server.log'),
logging.StreamHandler()
]
)
logger = logging.getLogger(__name__)
app = Flask(__name__)
@app.route('/')
def hello_world():
logger.info('Received request to /')
return 'Hello, World from python+pip!'
@app.route('/health')
def health_check():
logger.info('Received health check request')
return jsonify({
'status': 'healthy',
'timestamp': datetime.utcnow().isoformat(),
'version': '1.0.0'
})
if __name__ == '__main__':
logger.info('Starting server...')
app.run(host='0.0.0.0', port=3000, debug=True)