Learn how to deploy your Django web app for free using Render for hosting, Neon for the PostgreSQL database, and Cloudinary to store and manage your media files. This guide walks you through each step so you can get your project online quickly and easily.
*** build.sh file - content***
#!/usr/bin/env bash
Exit on error
set -o errexit
pip install -r requirements.txt
python manage.py collectstatic --no-input
python manage.py migrate
*** render.yaml file -content ***
databases:
- name: mysitedb
plan: free
databaseName: mysite
user: mysite
services:
type: web
plan: free
name: swiftgo
runtime: python
buildCommand: './build.sh'
startCommand: 'python -m gunicorn swiftgo.asgi:application -k uvicorn.workers.UvicornWorker'
envVars:
- key: DATABASE_URL
fromDatabase:
name: mysitedb
property: connectionString
- key: SECRET_KEY
generateValue: true
- key: WEB_CONCURRENCY
value: 4
*** Additional settings in the settings.py file ***
DEFAULT_FILE_STORAGE = 'cloudinary_storage.storage.MediaCloudinaryStorage'
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
'whitenoise.middleware.WhiteNoiseMiddleware',