2011-11-16 6 views
0

j'avais installer un simple projet Django en Hostmonster: Le nom du projet est thep_viet, l'application est MainApp mon .htaccess estDjango ne peut pas fonctionner dans Hostmonster

AddHandler fcgid-script .fcgi 
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ django.fcgi/$1 [QSA,L] 

mon django.fcgi est

#!/usr/bin/env python 
# -*- mode: python; -*- 

import sys, os 

# Add a custom Python path. 
sys.path.insert(0, "/home/riasolut/django/django_projects/") 

# Switch to the directory of your project. (Optional.) 
#os.chdir("/home/riasolut/django/django_projects/thep_viet") 

# Set the DJANGO_SETTINGS_MODULE environment variable. 
os.environ['DJANGO_SETTINGS_MODULE'] = "thep_viet.settings" 

from django.core.servers.fastcgi import runfastcgi 
runfastcgi(method="threaded", daemonize="false") 

Je python mise en 2.7.2 et 1.3.1 django avec succès

Je suis créer un dossier nommé thep_viet dans ~/django/django_projects /. Ce dossier contient tout le code source du projet p_viet.

Je crée un dossier nommé the_viet dans public_html et y place .htaccess et django.fcgi. Quand je suis en cours d'exécution django.fcgi par la ligne de commande:

python ~/public_html/thep_viet/django.fcgi 

Je reçois le résultat:

WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI! 
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI! 
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI! 
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI! 
Status: 200 OK 
Content-Type: text/html 


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html lang="en"><head> 
    <meta http-equiv="content-type" content="text/html; charset=utf-8"> 
    <meta name="robots" content="NONE,NOARCHIVE"><title>Welcome to Django</title> 
    <style type="text/css"> 
    html * { padding:0; margin:0; } 
    body * { padding:10px 20px; } 
    body * * { padding:0; } 
    body { font:small sans-serif; } 
    body>div { border-bottom:1px solid #ddd; } 
    h1 { font-weight:normal; } 
    h2 { margin-bottom:.8em; } 
    h2 span { font-size:80%; color:#666; font-weight:normal; } 
    h3 { margin:1em 0 .5em 0; } 
    h4 { margin:0 0 .5em 0; font-weight: normal; } 
    table { border:1px solid #ccc; border-collapse: collapse; width:100%; background:white; } 
    tbody td, tbody th { vertical-align:top; padding:2px 3px; } 
    thead th { padding:1px 6px 1px 3px; background:#fefefe; text-align:left; font-weight:normal; font-size:11px; border:1px solid #ddd; } 
    tbody th { width:12em; text-align:right; color:#666; padding-right:.5em; } 
    ul { margin-left: 2em; margin-top: 1em; } 
    #summary { background: #e0ebff; } 
    #summary h2 { font-weight: normal; color: #666; } 
    #explanation { background:#eee; } 
    #instructions { background:#f6f6f6; } 
    #summary table { border:none; background:transparent; } 
    </style> 
</head> 

<body> 
<div id="summary"> 
    <h1>It worked!</h1> 
    <h2>Congratulations on your first Django-powered page.</h2> 
</div> 

<div id="instructions"> 
    <p>Of course, you haven't actually done any work yet. Here's what to do next:</p> 
    <ul> 
    <li>If you plan to use a database, edit the <code>DATABASES</code> setting in <code>thep_viet/settings.py</code>.</li> 
    <li>Start your first app by running <code>python thep_viet/manage.py startapp [appname]</code>.</li> 
    </ul> 
</div> 

<div id="explanation"> 
    <p> 
    You're seeing this message because you have <code>DEBUG = True</code> in your 
    Django settings file and you haven't configured any URLs. Get to work! 
    </p> 
</div> 
</body></html> 

Il semble django peut fonctionner effectly

Mais quand je suis en cours d'exécution dans le navigateur :

thepviet.mydomain.com 

avec thepviet.mydomain.com points à mydomain.com/thep_viet~~V~~3rd

Je reçois l'erreur 500:

<!-- SHTML Wrapper - 500 Server Error --> 
[an error occurred while processing this directive] 

Ai-je oublié quelque chose? Je pense que quelque chose ne va pas dans config fastcgi dans apache de hostmonster.

S'il vous plaît aidez mon problème.


J'ai lu le journal des erreurs et trouvé:

[Fri Nov 18 19:50:04 2011] [warn] [client 113.185.2.152] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server 
[Fri Nov 18 19:50:04 2011] [error] [client 113.185.2.152] Premature end of script headers: django.fcgi 
[Fri Nov 18 19:50:04 2011] [error] [client 113.185.2.152] invalid CGI ref "/500.php" in /home4/riasolut/public_html/500.shtml 

Est-ce une erreur appartiennent au serveur FastCGI ou mon code?

+0

Il y a probablement une entrée dans le fichier journal des erreurs. Cela aiderait plus que probablement à trouver une réponse à votre question. –

Répondre

0

Vous avez une erreur de syntaxe dans votre fichier fcgi:

runfastcgi(method="threaded", "daemonize="false") 

La guillemet avant daemonize ne devrait pas être là. Comme le dit Jack M dans le commentaire, si vous aviez regardé dans le journal des erreurs du serveur, vous y verriez certainement l'erreur.

+0

J'ai corrigé la citation befor daemonize, c'est-à-dire mon erreur d'édition lors de la publication. J'ai lu le journal des erreurs et voir cette erreur: – ronin1184

Questions connexes