Will be a great way to save on cloud server costs or bootstrap your startup or experiment and learn! Some things to keep in mind: Your IP address can changer, or your local windows machine IP address ...
Will be a great way to save on cloud server costs or bootstrap your startup or experiment and learn!
Some things to keep in mind:
- Your IP address can changer, or your local windows machine IP address can change, so you will have to update the router settings whenever this happens
- Use the IP address of your local machine in your database settings
Requirements
- Windows 10 or 11
- Docker Desktop
- Django
- Python
- router login
Add a docker file
FROM python:latest ENV Debug=False ADD mysitedjango/requirements.txt /app/requirements.txt RUN set -ex \ && apt-get update \ && apt-get install -y libpq-dev build-essential \ && apt-get install -y python3-dev libffi-dev\ && python3 -m venv /env \ && /env/bin/pip3 install --upgrade pip \ && /env/bin/pip3 install --no-cache-dir -r /app/requirements.txt \ && apt-get autoremove -y \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ && runDeps="$(scanelf --needed --nobanner --recursive /env \ | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ | sort -u \ | xargs -r apt info --installed \ | sort -u)" \ && apt-get install -y $runDeps \ && apt-get remove -y $runDeps ADD mysitedjango /app WORKDIR /app ENV VIRTUAL_ENV /env ENV PATH /env/bin:$PATH EXPOSE 80 CMD ["gunicorn", "--bind", ":80", "--workers", "3", "mysiteDjango.wsgi:application"]
Docker command to make app live on port 80
docker build -t mysitedjango:v3 . && docker run -d --restart=always -p 80:80 mysitedjango:v3
Make changes in your router settings
- For this you need your own IP on your local network
- And your machine IP address
- Change port forwarding settings in your router settings to forward the port 80 to your machine IP address