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 5

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

Leave a comment

Required fields are marked