Edoruin commited on
Commit
1341ccf
1 Parent(s): 7642c91

Final fix for HF Spaces: relative paths, native static serving, and verbose logs

Browse files
Files changed (3) hide show
  1. Dockerfile +5 -3
  2. app.py +7 -1
  3. static/manifest.json +3 -3
Dockerfile CHANGED
@@ -14,10 +14,12 @@ COPY app.py .
14
  COPY models.py .
15
  COPY static/ ./static/
16
 
17
- # Hugging Face Spaces requires port 7860
18
  ENV PORT=7860
 
19
 
 
20
  EXPOSE 7860
21
 
22
- # Run with Gunicorn for production
23
- CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "120", "app:app"]
 
14
  COPY models.py .
15
  COPY static/ ./static/
16
 
17
+ # Hugging Face Spaces# Environment variables
18
  ENV PORT=7860
19
+ ENV PYTHONUNBUFFERED=1
20
 
21
+ # Expose port
22
  EXPOSE 7860
23
 
24
+ # Run with verbose logging
25
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "120", "--access-logfile", "-", "--error-logfile", "-", "app:app"]
app.py CHANGED
@@ -51,10 +51,16 @@ SPECIES_DATA = [
51
  captures_storage = []
52
 
53
 
 
 
 
 
 
54
  @app.route('/')
55
  def index():
56
  """Serve the main HTML page."""
57
- return send_from_directory('static', 'index.html')
 
58
 
59
 
60
  @app.route('/api/species', methods=['GET'])
 
51
  captures_storage = []
52
 
53
 
54
+ @app.before_request
55
+ def log_request_info():
56
+ """Log incoming requests for debugging."""
57
+ app.logger.debug(f"Request: {request.method} {request.url}")
58
+
59
  @app.route('/')
60
  def index():
61
  """Serve the main HTML page."""
62
+ app.logger.debug("Serving index.html")
63
+ return app.send_static_file('index.html')
64
 
65
 
66
  @app.route('/api/species', methods=['GET'])
static/manifest.json CHANGED
@@ -2,20 +2,20 @@
2
  "name": "Mi Pesca RD",
3
  "short_name": "MiPesca",
4
  "description": "Aplicaci贸n para registro de capturas pesqueras en Rep煤blica Dominicana",
5
- "start_url": "/",
6
  "display": "standalone",
7
  "background_color": "#ffffff",
8
  "theme_color": "#0D47A1",
9
  "orientation": "portrait",
10
  "icons": [
11
  {
12
- "src": "/assets/icon-192.png",
13
  "sizes": "192x192",
14
  "type": "image/png",
15
  "purpose": "any maskable"
16
  },
17
  {
18
- "src": "/assets/icon-512.png",
19
  "sizes": "512x512",
20
  "type": "image/png",
21
  "purpose": "any maskable"
 
2
  "name": "Mi Pesca RD",
3
  "short_name": "MiPesca",
4
  "description": "Aplicaci贸n para registro de capturas pesqueras en Rep煤blica Dominicana",
5
+ "start_url": "./",
6
  "display": "standalone",
7
  "background_color": "#ffffff",
8
  "theme_color": "#0D47A1",
9
  "orientation": "portrait",
10
  "icons": [
11
  {
12
+ "src": "assets/icon-192.png",
13
  "sizes": "192x192",
14
  "type": "image/png",
15
  "purpose": "any maskable"
16
  },
17
  {
18
+ "src": "assets/icon-512.png",
19
  "sizes": "512x512",
20
  "type": "image/png",
21
  "purpose": "any maskable"