Unable to get static css, pics from render when I pushed django successfully

Hi,

I can deplyo Django with docker and python3 environment on render successfully, and alos can access my website (URL: https://englam-test2.onrender.com/). But I can not get staic file (css, js, imgs) from my website. How to configure static file and environment?

MIDDLEWARE = [
‘django.middleware.security.SecurityMiddleware’,
‘whitenoise.middleware.WhiteNoiseMiddleware’,
‘django.contrib.sessions.middleware.SessionMiddleware’,
‘django.middleware.common.CommonMiddleware’,
‘django.middleware.csrf.CsrfViewMiddleware’,
‘django.contrib.auth.middleware.AuthenticationMiddleware’,
‘django.contrib.messages.middleware.MessageMiddleware’,
‘django.middleware.clickjacking.XFrameOptionsMiddleware’,
]

STATIC_HOST = “https://englam-test2.onrender.com
STATIC_URL = STATIC_HOST + “/static/”

STATICFILES_DIRS = [BASE_DIR/‘static’,]
STATIC_ROOT = BASE_DIR / ‘staticfiles’

Advanced → Environment Variables

ALLOWED_HOSTS = *
DEBUG = 1

Hey,

Are you still encountering the issue?

Make sure to cover the Render Django static files tutorial first: https://render.com/docs/deploy-django#static-files

Jérémy, Render Support

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.