Install python Django using cPanel

Overview

In this article, you will learn how to Install python Django using cPanel. First of all, Django is a Python framework that encourages rapid development, clean, and practical design. Designed by experienced developers, this takes care of a lot of web development hassles, so you can focus on writing your app without having to reinvent the wheel. It is free and open-source.

Note

In the following steps you will need to apply a command line, so if you have the “Terminal” option in your cPanel. If you couldn’t find it then please contact us at [email protected] to enable it for your domain.

Create a Python Application.

Our first to learn how to Install python Django using cPanel is by setting up the app.

  1. Go to Setup Python App and then click on Create Application and set the following:
    • Python Version: 3.7.3 “Recommended”.
    • Application Root: The folder path where you will start your Django app.
    • Application URL: The domain where you want your Django application to be live.
    • Application startup file: Enterpassenger_wsgi.py”.
    • Application entry point: Enter “application”.
  2. Click on Create.

Install Django

  1. After your python app is set up, you will see the note above your new application on the same page. The note contains a command line to be run, copy it.
  2. From cPanel, open Terminal. Paste the command line there and hit enter.
  3. Install version 2.1 of Django by running the following command:
    pip install django==2.1

Start a Django project

  1. In the Terminal, enter the following command:
    django-admin startproject app ~/appsite
    

    Note

    Replace “app” with your application name and “appsite” with the folder name you entered in Application Root.

  2. Open the File Manager and go to your Django app folder. Under this folder, you will be editing the file “passenger_wsgi.py” and “settings.py” under the application subfolder in the next steps.
  3. Open the file “passenger_wsgi.py”, delete everything and enter the following line: From app.wsgi import application Note: replace “app” with your application name.
  4. Now, open your application subfolder and edit the file “settings.py”.
  5. Find the line starts with “ALLOWED_HOSTS” and enter your application domain between ‘’. Example:
    ALLOWED_HOSTS = [‘example.ly’]
  6. Now go back to Set up Python app in your and Restart your application.
Share this:
FacebookTwitterWhatsAppViberCopy LinkTelegramLinkedIn
Updated on June 28, 2020
Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support