Vedang2004 commited on
Commit
90f5bb2
·
verified ·
1 Parent(s): 4847e7d

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. Dockerfile +0 -6
  2. solar_project/settings.py +2 -0
Dockerfile CHANGED
@@ -2,27 +2,21 @@ FROM python:3.11-slim
2
 
3
  WORKDIR /app
4
 
5
- # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  libpq-dev \
8
  gcc \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
- # Install CPU only torch first (smaller size)
12
  RUN pip install torch==2.10.0+cpu --index-url https://download.pytorch.org/whl/cpu
13
 
14
- # Copy and install requirements
15
  COPY requirements.txt .
16
  RUN pip install --no-cache-dir -r requirements.txt
17
 
18
- # Copy project files
19
  COPY . .
20
 
21
  # Collect static files
22
  RUN python manage.py collectstatic --no-input
23
 
24
- # Expose Hugging Face default port
25
  EXPOSE 7860
26
 
27
- # Start server
28
  CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--timeout", "120", "solar_project.wsgi:application"]
 
2
 
3
  WORKDIR /app
4
 
 
5
  RUN apt-get update && apt-get install -y \
6
  libpq-dev \
7
  gcc \
8
  && rm -rf /var/lib/apt/lists/*
9
 
 
10
  RUN pip install torch==2.10.0+cpu --index-url https://download.pytorch.org/whl/cpu
11
 
 
12
  COPY requirements.txt .
13
  RUN pip install --no-cache-dir -r requirements.txt
14
 
 
15
  COPY . .
16
 
17
  # Collect static files
18
  RUN python manage.py collectstatic --no-input
19
 
 
20
  EXPOSE 7860
21
 
 
22
  CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--timeout", "120", "solar_project.wsgi:application"]
solar_project/settings.py CHANGED
@@ -58,6 +58,7 @@ INSTALLED_APPS = [
58
  MIDDLEWARE = [
59
  "corsheaders.middleware.CorsMiddleware",
60
  "django.middleware.security.SecurityMiddleware",
 
61
  "django.contrib.sessions.middleware.SessionMiddleware",
62
  "django.middleware.common.CommonMiddleware",
63
  "django.middleware.csrf.CsrfViewMiddleware",
@@ -165,3 +166,4 @@ USE_TZ = True
165
  # https://docs.djangoproject.com/en/6.0/howto/static-files/
166
 
167
  STATIC_URL = 'static/'
 
 
58
  MIDDLEWARE = [
59
  "corsheaders.middleware.CorsMiddleware",
60
  "django.middleware.security.SecurityMiddleware",
61
+ "whitenoise.middleware.WhiteNoiseMiddleware",
62
  "django.contrib.sessions.middleware.SessionMiddleware",
63
  "django.middleware.common.CommonMiddleware",
64
  "django.middleware.csrf.CsrfViewMiddleware",
 
166
  # https://docs.djangoproject.com/en/6.0/howto/static-files/
167
 
168
  STATIC_URL = 'static/'
169
+ STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'