Skip to content

nullfunc/defang-django-channels-redis-postgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Channels & Redis & Postgres

1-click-deploy

This sample demonstrates how to get Django Channels up and running with Redis and Postgres both managed by Defang. It demonstrates how to do this with a simple chat application.

Prerequisites

  1. Download Defang CLI
  2. (Optional) If you are using Defang BYOC authenticated with your AWS account
  3. (Optional for local development) Docker CLI

Development

To run the application locally, you can use the following command:

docker compose -f compose.dev.yaml up

This will start the Django server, Redis, and Postgres and mounts your Django app so you get live reloading. You can access the Django server at http://localhost:8000.

Configuration

For this sample, you will need to provide the following configuration. Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.

SECRET_KEY

The secret key for your Django application. You can generate a new one by running python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'. A default, insecure key is used if this is not set, but you should set it for a production deployment.

POSTGRES_PASSWORD

The password for your Postgres database. You need to set this before deploying for the first time.

Deploying

  1. Open the terminal and type defang login
  2. Use the defang config command to setup environment variables.
  3. Type defang compose up in the CLI.
  4. Your app will be running within a few minutes.

Title: Django Channels & Redis & Postgres

Short Description: A basic configuration of Django Channels with Redis and Postgres demonstrating a simple chat application.

Tags: Django, Channels, Redis, Postgres, Chat, Application

Languages: Python

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published