Install and run Python Django using cPanel

This tutorial explains how to use Django framework.

Step One:

  1. Login to your cPanel account.
  2. Click on “Setup Python App”

 

Step Two:

  1. Select Python version from the drop-down list.
  2. Specify your application directory.
  3. Click “setup” button.

Step Three:

  1. Go to “modules” and click on “Show”.
  2.  Type “Django” and click on it.
  3.  Select the desired Django version.
  4. Click “Add”.
  5. Click on “Update” button followed by restart button.

 

 

Step Four:

  1. Edit “.bash_profile”. You can do that from cPanel –> File Manager.
    Make sure that “Show Hidden Files (dotfiles)” is selected from File Manager –> Settings.
  2. Add the following line at the bottom and save:
    source virtualenv / NN / VV / bin / activate
    Where NN is the folder that is created in Step Three, and VV is the version of Python.

 

Step Five:

  1. Go back to “Setup Python App”
  2.  Click on “Edit” next to “WSGI file location” and add the wsgi.py path.
    ie. python/wsgi.py:application

 

 

Note

If you can not find “Setup Python App” icon in cPanel, please contact support to enable it.

  • Was this Helpful ?
  • Yes   No
in

Comments 8

irwan

16/02/2018at22:05

my step after install django (view default django worked ), but after create project

i have an error ‘The server encountered an unexpected condition which prevented it from fulfilling the request.’

on step 5, my wsgi.py path is on folder project ‘/home/autogila/pythonsite/pythonsite/wsgi.py’.
so, i am edited my python setup like ‘/home/autogila/pythonsite/pythonsite.wsgi.py:application’

what’s the problem with it?

Reply

Chris Shaw

26/02/2018at14:16

Good Day, I have found this article when searching for how to host Django 1.10 on my hosting provider. I had done all the steps, and it almost works. But when I try to log into the admin, or send any post to any app, Django only seems to look though the root urls, not the apps or admin, so always returns a 404. This is very frustrating. Is there something I am missing?

Reply

Ahmed Shibani

1/03/2018at10:13

Hello Chris,

This is most likely an issue with the urls.py file. Double check that the admin and app urls are included or post it here to take a look.

Reply

hamba

26/02/2018at15:00

hey,

i was wondering why when i open my app uri it takes so damn long, and throws me an 500 RTO error. i have followed all your instructions, and read on the other websites too, but still i have no idea why. please help me because this is my first time using python app on real website.

thank you.

Reply

Ahmed Shibani

1/03/2018at10:16

Hey,

A 500 error indicates either there was not enough resources to handle the request or there is some kind of loop causing the process to run out of allowed time to execute. I’d recommend you check your wsgi.py is correct, you can also enable Django debug mode, this might provide you with more information.

Reply

George

26/05/2018at16:14

https://cgi-sql.com/q#

We are not able to get this working

WE are facing below error …

We’re sorry, but something went wrong.
The issue has been logged for investigation. Please try again later.

Technical details for the administrator of this website
Error:
Web application could not be started
Error ID:
38e34401
Details:
Web application could not be started by the Phusion Passenger application server.

Please read the Passenger log file (search for the Error ID) to find the details of the error.

You can also get a detailed report to appear directly on this page, but for security reasons it is only provided if Phusion Passenger is run with environment set to development and/or with the friendly error pages option set to on.

For more information about configuring environment and friendly error pages, see:

Nginx integration mode
Apache integration mode
Standalone mode

Can you please help me to get this resolved.

Reply

Ahmed Shibani

28/06/2018at11:01

Hi George

I just checked the URL you provided and I can see you have already fixed the issue.

Thanks for stopping by.

Reply

mohammad

4/07/2018at14:23

how can I serve my media with debug=false ??

Reply

Leave a comment

Required fields are marked