Articles in this section

Django - Gateway 502 errors

If your encountering 502 errors when accessing your Django application, make sure your wsgi.py is included in your project directory.
 

Making sure your start command looks like:

start: "gunicorn -w 4 -b unix:$SOCKET djangoProject.wsgi:application"

And your .upsun.app.yaml file for example:

name: "ll_project"
type: "python:3.8"

relationships:
    database: "db:postgresql"

web:
    upstream:
      socket_family: unix
    commands:
      start: "gunicorn -w 4 -b unix:$SOCKET ll_project.wsgi:application"
    locations:
      "/":
          passthru: true
      "/static":
          root: "static"
          expires: 1h
          allow: true
disk: 512
mounts:
    "logs":
        source: local
        source_path: logs
hooks:
    build: |
        pip install --upgrade pip
        pip install -r requirements.txt
        pip install -r requirements_remote.txt
      
        mkdir logs
        python manage.py collectstatic
        rm -rf logs
    deploy: |
        python manage.py migrate

routes.yaml
"https://{default}/":
    type: upstream
    upstream: "ll_project:http"

"https://www.{default}/":
    type: redirect
    to: "https://{default}/"

services.yaml
db:
    type: postgresql:12
    disk: 1024
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.