1.
Create a Python app: In cPanel, locate the "Software" section and find the
"Python" or "Python Selector" option. Create a new Python application and select
the desired Python version.
2.Install project dependencies: Using cPanel's terminal or SSH access, navigate to
the root directory of your Django project. Install the project's dependencies by
running pip install -r requirements.txt. Make sure you have a requirements.txt file
listing all the dependencies.
3.Configure the Django project: Modify the project's settings to work with the
production environment. Ensure that the database connection settings, static files
configuration, and other relevant settings are properly configured.
4.Set up a virtual environment: Create a virtual environment for your Django
project. In cPanel's terminal or SSH, navigate to the project directory and run
python -m venv myenv to create the virtual environment.
4.Activate the virtual environment: Activate the virtual environment by running
source myenv/bin/activate.
5.Collect static files: Run python manage.py collectstatic to gather all the static
files from your Django project into a single directory.
6.Set up a web server: In cPanel, locate the "Software" section and find the "Setup
Python App" or similar option. Set up the Python application to specify the
project's root directory, application startup file (e.g., wsgi.py), and the URL
path.
6.Set up a database: In cPanel, create a new MySQL or PostgreSQL database and user.
Update the Django project's settings to use the database credentials provided by
cPanel.
7.Migrate the database: Run python manage.py migrate in cPanel's terminal or SSH to
apply any pending database migrations.
8.Test the deployment: Access your Django project through the provided URL or your
domain name to verify that it's working correctly in the production environment.
note---
1. Check whether you have created a database and configured the same database in
your settings if you are experiencing any database-related issues."py file"
2. To connect to a MySQL database if you are experiencing installation issues with
the mysql-client, use py-mysql.
update below code in __init__ files
init.py
import pymysql
pymysql.install_as_MySQLdb()
3.update passenger.py file with follwing code
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', '(YOUR PROJECT APP
NAME).settings')
application = get_wsgi_application()
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'banner_apis.settings')
application = get_wsgi_application()
app = application