Skip to content

descope-sample-apps/django-sample-app

Repository files navigation

django

Descope Django Sample App

Learn how to integrate Descope authentication in Django by building a Quillbot clone.

⚙️ Setup

  1. Clone the repository:
git clone https://github.com/descope-sample-apps/django-sample-app.git
  1. Create virtual environment and install dependencies:
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
  1. Environment variables
DESCOPE_PROJECT_ID=YOUR_DESCOPE_PROJECT_ID
  • DESCOPE_PROJECT_ID: can be found in your Descope's account under the Project page

🔮 Running the Application

To start the application, run:

python3 manage.py runserver

🥷 Roles

Sign up for Descope and create admin roles here.

Create two roles in Descope, that will be mapped to Django permissions.

  • is_staff
  • is_superuser

Map these roles to any user you would like to make a staff or superuser in your Django app.

🚀 Heroku Deployment

  • The Procfile, requirements.txt and runtime.txt are used in deployment
  • Add urls to CORS_ALLOWED_ORIGINS if running outside localhost
  • Change SECRET_KEY if running in production
  • Ensure DATABASE_URL and DESCOPE_PROJECT_ID are set in config vars
  • If using Cloudflare as your DNS and pointing to a custom domain, ensure Cloudflare proxy is off for your CNAME record (unless you are using Full SSL/TLS encryption mode, Flexible mode will not work due to CORS validation)

⚠️ Issue Reporting

For any issues or suggestions, feel free to open an issue in the GitHub repository.

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.