简体   繁体   中英

Django app deployment on shared hosting

I am trying to deploy a django app on hostgator shared hosting. I followed the hostgator django installation wiki and i deployed my app. The issue is that i am getting a 500 error internal page when entering the site url in the browser. I contacted the support team but could not provide enough info on troubleshooting the error Premature end of script headers: fcgi .This was the error found on the server error log.

I am installed django 1.9.5 on the server and from the django documentation it does not support fastcgi.

So my question 500 error be caused by the reason that i am running django 1.9.5 on the server and it does not support fastcgi. if so do i need to install lower version of django to support the fastcgi supported by hostgator shared hosting

First i thought the error was caused by my .htaccess file but it has no issue from the what i heard from support team.

Any Leads to how i can get the app up and running will be appreciated. This is my first time with django app deployment. Thank you in advance

As you say, Django 1.9 does not support FastCGI.

You could try using Django 1.8, which is a long term support release and does still support FastCGI.

Or you could switch to a different host that supports deploying Django 1.9 with wsgi.

I know this is a while as to when i asked the question. I finally fixed this by changing the hosts. I went for Digital Oceans (created a new droplet) which supports wsgi. I deployed the app using gunicorn (application server) and nginx (proxy server).

It is not a good idea to deploy a Django app on shared hosting as you will be limited especially installing the required packages.

Many hostings today that support python use Phusion Passenger and I have been able to deploy Django on it successfully. Before I share the procedure, let me mention that I faced a lot of problems in doing this and now I have the solution to all of them. I have already written a step by step guide on my blog here to deploy a Django app on shared hosting.

  • Start a new python app in cpanel. Specify the url where you want the app to be and the folder where you want to put the contents of the app. Set the Application startup file to passenger_wsgi.py and the Application entry point to application .
  • Copy the command to enter the virtual environment and run it via online terminal in CPanel or SSH.
  • Install version 2.1 of Django (latest 2.2 will not work) pip install django==2.1
  • Upload your django project to the folder you specified while setting up the app. There will be a passenger_wsgi.py file in that folder. Edit it and enter the following code: (replace myapp with your application name)

from myapp.wsgi import application

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM