简体   繁体   中英

Problems with fastcgi when installing Django on Justhost

I am following the following tutorial at http://flailingmonkey.com/install-django-justhost/ to install Django on my Justhost web server. So far I have managed to install Django and Python on my Justhost shared web server.

However, I am now stuck when trying to configure my new site. Every time I run the command: python mysite.fcgi I keep getting the following error message:

Traceback (most recent call last):
  File "mysite.fcgi", line 9, in <module>
    from django.core.servers.fastcgi import runfastcgi
ImportError: No module named fastcgi

Content of mysite.fcgi

#!/home4/xxxxx/python/bin/python
import sys, os    

# Where /home/your_username is the path to your home directory
sys.path.insert(0, "/home4/xxxxx/python")
sys.path.insert(13, "/home4/xxxxx/public_html/django-project/admin")

os.environ['DJANGO_SETTINGS_MODULE'] = 'admin.settings'
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")

How do I fix it?

I had the exact same issue. Heres how to solve it

load up your ssh client

cd ~/
pip install django==1.8.7
pip install flup==1.0.2

and you should be good

If you need FastCGI support for Django version 1.9 or higher, see https://github.com/NetAngels/django-fastcgi . You still need to install flup separately as @dvicemuse advised.

Also, official Django version 1.8 FastCGI docs may help, see https://docs.djangoproject.com/en/1.8/howto/deployment/fastcgi/#running-django-on-a-shared-hosting-provider-with-apache

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