<p>The DevSpace-Django tutorial in question is the following:</p>
<p><a href="https://devspace.cloud/blog/2019/10/18/deploy-django-to-kubernetes" rel="nofollow noreferrer">https://devspace.cloud/blog/2019/10/18/deploy-django-to-kubernetes</a></p>
<p>Trying something completely barebones to understand how <code>devspace</code> works to decide if I want to make the switch from <code>skaffold</code>. There are a number of things in the above tutorial that seem to be no longer accurate or have changed in more recent versions of <code>devpsace</code>.</p>
<p>At any rate, I'm not able to connect to the <a href="https://docs.djangoproject.com/en/3.2/intro/tutorial01/#the-development-server" rel="nofollow noreferrer">Django tutorial app</a> when I navigate to <code>localhost:8000</code>. It just says &quot;Can't connect to the server.&quot;</p>
<p>This is the output I get when I <code>devspace dev</code>:</p>
<pre><code> devspace dev
[warn]   There is a newer version of DevSpace: v5.15.0. Run `devspace upgrade` to upgrade to the newest version.

[info]   Using namespace 'mysite'
[info]   Using kube context 'mysite'
[info]   Execute 'helm upgrade mysite component-chart --namespace mysite --values /var/folders/tl/wqf19mws155_7bkqyw401z_w0000gn/T/325113665 --install --repo https://charts.devspace.sh --repository-config='' --version 0.8.0 --kube-context mysite'
[info]   Execute 'helm list --namespace mysite --output json --kube-context mysite'
[done] √ Deployed helm chart (Release revision: 5)                    
[done] √ Successfully deployed mysite with helm                       
[done] √ Port forwarding started on 8000:8000 (mysite/mysite-7b856bb78b-2ztpf-devspace)
                                             
#########################################################
[info]   DevSpace UI available at: http://localhost:8090
#########################################################

[0:sync] Waiting for pods...
[0:sync] Starting sync...
[0:sync] Sync started on /Users/cjones/Projects/Apps/Test/mysite &lt;-&gt; . (Pod: mysite/mysite-7b856bb78b-2ztpf-devspace)
[0:sync] Waiting for initial sync to complete
[info]   Opening 'http://localhost:8000' as soon as application will be started (timeout: 4m0s)
[info]   Opening shell to pod:container mysite-7b856bb78b-2ztpf-devspace:container-0
Installing Python Dependencies
Requirement already satisfied: asgiref==3.4.1 in /usr/local/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (3.4.1)
Requirement already satisfied: Django==3.2.7 in /usr/local/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (3.2.7)
Requirement already satisfied: pytz==2021.1 in /usr/local/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (2021.1)
Requirement already satisfied: sqlparse==0.4.1 in /usr/local/lib/python3.9/site-packages (from -r requirements.txt (line 4)) (0.4.1)
WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 21.1.2; however, version 21.2.4 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.

   ____              ____
  |  _ \  _____   __/ ___| _ __   __ _  ___ ___
  | | | |/ _ \ \ / /\___ \| '_ \ / _` |/ __/ _ \
  | |_| |  __/\ V /  ___) | |_) | (_| | (_|  __/
  |____/ \___| \_/  |____/| .__/ \__,_|\___\___|
                          |_|

Welcome to your development container!

This is how you can work with it:
- Run `python main.py` to build the application
- Files will be synchronized between your local machine and this container
- Some ports will be forwarded, so you can access this container on your local machine via localhost:


 Image   ImageSelector   LabelSelector   Ports (Local:Remote)  
         username/app                    8000:8000             

root@mysite-7b856bb78b-2ztpf-devspace:/app# 
</code></pre>
<p>This is the <code>DevSpace.yaml</code>:</p>
<pre><code>version: v1beta10

# `vars` specifies variables which may be used as ${VAR_NAME} in devspace.yaml
vars:
- name: IMAGE
  value: username/app

# `deployments` tells DevSpace how to deploy this project
deployments:
- name: mysite
  # This deployment uses `helm` but you can also define `kubectl` deployments or kustomizations
  helm:
    # We are deploying the so-called Component Chart: https://devspace.sh/component-chart/docs
    componentChart: true
    # Under `values` we can define the values for this Helm chart used during `helm install/upgrade`
    # You may also use `valuesFiles` to load values from files, e.g. valuesFiles: [&quot;values.yaml&quot;]
    values:
      containers:
      - image: ${IMAGE} # Use the value of our `${IMAGE}` variable here (see vars above)
      service:
        ports:
        - port: 8000

# `dev` only applies when you run `devspace dev`
dev:
  # `dev.ports` specifies all ports that should be forwarded while `devspace dev` is running
  # Port-forwarding lets you access your application via localhost on your local machine
  ports:
  - imageSelector: ${IMAGE} # Select the Pod that runs our `${IMAGE}`
    forward:
    - port: 8000

  # `dev.open` tells DevSpace to open certain URLs as soon as they return HTTP status 200
  # Since we configured port-forwarding, we can use a localhost address here to access our application
  open:
  - url: http://localhost:8000

  # `dev.sync` configures a file sync between our Pods in k8s and your local project files
  sync:
  - imageSelector: ${IMAGE} # Select the Pod that runs our `${IMAGE}`
    excludePaths:
    - .git/
    uploadExcludePaths:
    - Dockerfile

  # `dev.terminal` tells DevSpace to open a terminal as a last step during `devspace dev`
  terminal:
    imageSelector: ${IMAGE} # Select the Pod that runs our `${IMAGE}`
    # With this optional `command` we can tell DevSpace to run a script when opening the terminal
    # This is often useful to display help info for new users or perform initial tasks (e.g. installing dependencies)
    # DevSpace has generated an example ./devspace_start.sh file in your local project - Feel free to customize it!
    command:
    - ./devspace_start.sh

  # Since our Helm charts and manifests deployments are often optimized for production,
  # DevSpace let's you swap out Pods dynamically to get a better dev environment
  replacePods:
  - imageSelector: ${IMAGE} # Select the Pod that runs our `${IMAGE}`
    # Since the `${IMAGE}` used to start our main application pod may be distroless or not have any dev tooling, let's replace it with a dev-optimized image
    # DevSpace provides a sample image here but you can use any image for your specific needs
    replaceImage: loftsh/python:latest
    # Besides replacing the container image, let's also apply some patches to the `spec` of our Pod
    # We are overwriting `command` + `args` for the first container in our selected Pod, so it starts with `sleep 9999999`
    # Using `sleep 9999999` as PID 1 (instead of the regular ENTRYPOINT), allows you to start the application manually
    patches:
    - op: replace
      path: spec.containers[0].command
      value:
      - sleep
    - op: replace
      path: spec.containers[0].args
      value:
      - &quot;9999999&quot;
    - op: remove
      path: spec.containers[0].securityContext

# `profiles` lets you modify the config above for different environments (e.g. dev vs production)
profiles:
  # This profile is called `production` and you can use it for example using: devspace deploy -p production
  # We generally recommend to use the base config without any profiles as optimized for development (e.g. image build+push is disabled)
- name: production
# This profile adds our image to the config so that DevSpace will build, tag and push our image before the deployment
  merge:
    images:
      app:
        image: ${IMAGE} # Use the value of our `${IMAGE}` variable here (see vars above)
        dockerfile: ./Dockerfile

</code></pre>
<p>This is the <code>Dockerfile</code>:</p>
<pre><code>FROM python:3.8-slim-buster

# Create project directory (workdir)
WORKDIR /app

# Add requirements.txt to WORKDIR and install dependencies
COPY requirements.txt .
RUN pip install -r requirements.txt

# Add source code files to WORKDIR
ADD . .

# Application port (optional)
EXPOSE 8000

# Container start command
# It is also possible to override this in devspace.yaml via images.*.cmd
CMD [&quot;manage.py&quot;, &quot;runserver&quot;, &quot;8000&quot;]
</code></pre>
<p>Both DevSpace UI and <code>kubectl get pods</code> show the Pod is running.</p>
<p>This is deploying to <code>minikube</code> using the Docker driver.</p>
<p>Nothing else is running on port <code>8000</code> and I've also tried <code>8080</code> by changing every occurrence of <code>8000</code> to <code>8080</code>.</p>
<p>The Django project is only what you get when you run: <code>django-admin startproject mysite</code>. Nothing fancy.</p>
<p>It isn't clear to me what I'm doing wrong here. Suggestions?</p>
<p>EDIT:</p>
<p>Also, meant to point out on M1 Mac. Not sure if it could be related but worth pointing out.</p>
<p>Tried with <code>docker-desktop</code> cluster and <code>minikube</code> thinking it could be a potential issue with <code>minikube</code>. Same issue.</p>
<p>Also, tried the Quick Start guide here using a DevSpace provided project with the same results:</p>
<p><a href="https://devspace.sh/cli/docs/quickstart" rel="nofollow noreferrer">https://devspace.sh/cli/docs/quickstart</a></p>

cjones
<p>Kind of important step being left off of the <a href="https://devspace.cloud/blog/2019/10/18/deploy-django-to-kubernetes" rel="nofollow noreferrer">Django tutorial</a>. After running <code>devspace dev</code>, you need to run in the <code>devspace</code> CLI that comes up:</p>
<pre><code>./manage.py runserver
</code></pre>
<p>This will launch the application in browser.</p>
