Skip to content

Instantly share code, notes, and snippets.

@devmahmud
Created January 26, 2021 06:01
Show Gist options
  • Save devmahmud/01e49024ba049636b45fe04b6a52f184 to your computer and use it in GitHub Desktop.
Save devmahmud/01e49024ba049636b45fe04b6a52f184 to your computer and use it in GitHub Desktop.
Run django web application in Linux Shared Hosting CPanel
import os
import sys
# pymysql is an alternative for mysqlclient
# import pymysql
# set variables
sys.path.append(os.getcwd())
os.environ['DJANGO_SETTINGS_MODULE'] = 'your_project_name.settings'
# setup django application
import django.core.handlers.wsgi
from django.core.wsgi import get_wsgi_application
# Initialize pymysql
# pymysql.install_as_MySQLdb()
application = get_wsgi_application()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment