| # Definir la imagen | |
| FROM debian:12.10 | |
| # Instalar Python y venv para entornos virtuales | |
| RUN apt -y update | |
| RUN apt install -y python3 python3-pip python3-django python3-mysqldb | |
| #RUN python3 -m django --version [3.2.19] | |
| # Pasos del tutorial de DJango | |
| RUN mkdir itsz | |
| WORKDIR itsz | |
| #RUN django-admin startproject miSitio | |
| # Algo para que funcionen | |
| #RUN sed -i 's/ALLOWED_HOSTS = \[\]/ALLOWED_HOSTS = \["*"\]/g' miSitio/settings.py | |
| # Crear app de Poll o encuestas | |
| #RUN python3 manage.py startapp polls | |
| COPY app ./misite | |
| WORKDIR misite | |
| RUN touch db.sqlite3 | |
| RUN chmod 777 db.sqlite3 | |
| RUN chmod 777 ./polls/migrations | |
| CMD python3 manage.py makemigrations; \ | |
| python3 manage.py migrate; \ | |
| python3 manage.py createsuperuser --noinput;\ | |
| python3 manage.py runserver 0:7860; \ | |
| # Verificar si python esta instalado | |
| # RUN which python || which python3 || which py | |
| # Version Python | |
| # RUN python3 --version | |
| # Activar el entorno virutal | |
| # RUN python3 -m venv django | |
| # RUN python3 django/bin/activate | |
| # Instalar DJango | |
| # RUN python3 -m pip install Django==5.1.7 | |