Spaces:
Sleeping
Sleeping
| # Use the official Python image | |
| FROM python:3.13-slim | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE 1 | |
| ENV PYTHONUNBUFFERED 1 | |
| # Set work directory | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| gcc \ | |
| libpq-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --upgrade pip | |
| RUN pip install -r requirements.txt | |
| # Copy project | |
| COPY . . | |
| # RUN chown www-data: /app/db.sqlite3 | |
| RUN chmod -R 777 /app | |
| # Collect static files (optional if you want to serve static files from the app itself) | |
| # RUN python manage.py collectstatic --noinput | |
| # Expose port 8000 | |
| EXPOSE 7860 | |
| # Run the Django app | |
| CMD ["bash", "-c", "python manage.py migrate && python create_superuser.py && python manage.py runserver 0.0.0.0:7860"] | |