Try Devtron Enterprise!
Start Free Trial
LogoLogo
WebsiteDevtron demoGithub RepoJoin Discord
v0.5
v0.5
  • Overview
  • Getting Started
    • Install Devtron
      • Install Devtron with CI/CD integration
      • Install Devtron
      • Install Devtron on Minikube, Microk8s, K3s, Kind
      • Installation Configurations
      • Override Configurations
      • Ingress setup for Devtron Installation
    • Global Configurations
      • GitOps
      • Projects
      • Cluster And Environments
        • Namespaces And Environments
      • Git Accounts
      • Container Registries
      • Chart Repositories
      • Custom charts
      • SSO Login Service
      • Authorization
        • User Permissions
        • Permission Groups
        • API Tokens
      • Manage Notification
      • External links
    • Devtron Upgrade
      • Update Devtron from Devtron UI
      • 0.4.x-0.5.x
      • 0.4.x-0.4.x
      • 0.3.x-0.4.x
      • 0.3.x-0.3.x
      • 0.2.x-0.3.x
  • Usage
    • Applications
      • Create a new application
      • Clone an existing application
      • Deploy a sample application
      • App Configuration
        • Git Repository
        • Docker Build Configuration
        • Deployment Template
          • Deployment
          • Rollout Deployment
          • Job and Cronjob
        • Workflow Overview
        • CI Pipeline
          • Pre-Build/Post-Build Tasks
        • CI Pipeline (Legacy)
        • CD Pipeline
        • Config Maps
        • Secrets
        • Environment Overrides
        • Deleting Application
      • Build and Deploy
        • Triggering CI
        • Triggering CD
      • App Details
        • Debugging Deployment And Monitoring
        • Application Metrics
    • Charts
      • Charts Overview
      • Deploy & Observe
      • Examples
        • Deploying Mysql Helm Chart
        • Deploying MongoDB Helm Chart
      • Chart Group
    • Security
    • Bulk Edit
    • Integrations
  • Resources
    • Troubleshooting
    • Use Cases
      • Devtron Generic Helm Chart To Run CronJob Or One Time Job
      • Connect SpringBoot with Mysql Database
      • Connect Expressjs With Mongodb Database
      • Connect Django With Mysql Database
    • Telemetry Overview
  • Deprecated
    • Hyperion
Powered by GitBook
On this page
  • Introduction
  • 1. Deploy a mysql Helm Chart
  • 2. Fork the Git Repository
  • 3. Create Application on Devtron
  • 4. Final Step

Was this helpful?

Export as PDF
  1. Resources
  2. Use Cases

Connect Django With Mysql Database

PreviousConnect Expressjs With Mongodb DatabaseNextTelemetry Overview

Last updated 2 years ago

Was this helpful?

Introduction

Django is a free, open-source web framework written in Python programming language. It allows for scalability, re-usability, and rapid development. Django can be connected to different databases like MySQL, PostgreSQL, etc.

1. Deploy a mysql Helm Chart

To deploy mysql Helm Chart, you can refer to our documentation on

2. Fork the Git Repository

For this example, we are using the following , you can clone this repository and make following changes in the files.

*Configure Database Settings

Go to mysite/settings.py.

The settings.py contains the configuration for your SQL database. Make sure the configurations in settings.py matches the configurations of the mysql Helm Chart, that you have deployed in Step 1.

 DATABASES = {
    'default': {
        # If you are using Cloud SQL for MySQL rather than PostgreSQL, set
        # 'ENGINE': 'django.db.backends.mysql' instead of the following.
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': '<mysql-database>',
        'USER': '<mysql-user>',
        'PASSWORD': '<mysql-password>',
        'HOST': '<service-name>',
        'PORT': '3306',
    }
}

3. Create Application on Devtron

*Git Repository

In this example, we are using the url of the forked Git Repository.

*Docker configuration

Give, the path of the Dockerfile.

*Configure Deployment Template

Enable Ingress, and give the path on which you want to host the application.

*Set up the CI/CD Pipelines

Set up the CI/CD pipelines. You can set them to trigger automatically or manually.

*Trigger Pipelines

Trigger the CI Pipeline, build should be Successful, then trigger the CD Pipeline, deployment pipeline will be initiated, after some time the status should be Healthy.

4. Final Step

Check the Django app connected to mysql database, running successfully by hitting your application url.

The syntax is: http://<hostname>/<path>/

path will be the one that you have given in Step 3 while configuring the Deployment Template.

To learn how to create an application on Devtron, refer to our documentation on

Deploy mysql Helm Chart
GitHub Repo
Creating Application