Skip to content
This repository has been archived by the owner on May 8, 2019. It is now read-only.
/ charlette Public archive

Django app that uses Starlette components with Channels

License

Notifications You must be signed in to change notification settings

jordaneremieff/charlette

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

charlette

Charlette is a reusable Django app that provides a simple means of configuring a Channels-enabled project to use components from the ASGI library Starlette.

It is intended to demonstrate the composability of ASGI applications.

Requirements: Python 3.6+

Setup

  • pip3 install charlette

  • Create a project, example, with the command: charlette startproject <projectname>. This will generate a Django project with Charlette's configuration.

  • Create an app, myapp, with the command: charlette startapp myapp. This will generate a boilerplate app that uses Starlette's application class and a custom TemplateEndpoint provided by Charlette.

  • Add the app to the INSTALLED_APPS in the Django settings.py file:

INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    ...
    "myapp",
    ...
    "charlette",
    "channels",
]
  • Import the app in the routing.py file and mount it to the main Starlette application.
from starlette.applications import Starlette

from myapp.endpoints import myapp

application = Starlette(debug=True)
application.mount("/myapp", myapp)
  • Navigate to http://localhost:8000/myapp/ in your browser.

About

Django app that uses Starlette components with Channels

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published