2011-07-14 8 views
0

je suis en train de mod_wsgi de configuration pour servir mes fichiers multimédias django (je veux utiliser aussi dans un env Developement)mod_wsgi erreur de syntaxe: « importation de commande non valide »

J'ai suivi this guide à mod_wsgi de configuration correctement.

Ceci est mon fichier wsgi (le "django.wsgi")

import os, sys 

path = '/home/smau/Workspace/Maynard/tothego_frontend/' 
if path not in sys.path: 
    sys.path.append(path) 

#Calculate the path based on the location of the WSGI script. 
apache_configuration= os.path.dirname(__file__) 
project = os.path.dirname(apache_configuration) 
workspace = os.path.dirname(project) 
sys.path.append(workspace) 

os.environ['DJANGO_SETTINGS_MODULE'] = 'tothego_frontend.settings' 

import django.core.handlers.wsgi 
application = django.core.handlers.wsgi.WSGIHandler() 

Ceci est mon fichier de configuration ("de django.conf")

Alias /site_media/ "/home/smau/Workspace/Maynard/tothego_frontend/site_media/" 
<Directory "/home/smau/Workspace/Maynard/tothego_frontend/site_media"> 
Order allow,deny 
Options Indexes 
Allow from all 
IndexOptions FancyIndexing 
</Directory> 

WSGIScriptAlias/"/home/smau/Workspace/Maynard/tothego_frontend/srv/mod_wsgi/django.wsgi" 

<Directory "/home/smau/Workspace/Maynard/tothego_frontend/srv/mod_wsgi"> 
Allow from all 
</Directory> 

Ceci est mon "httpd.conf"

Include /home/smau/Workspace/Maynard/tothego_frontend/srv/mod_wsgi/django.wsgi 

Tout semble être comme le guide, cependant, lorsque je tente de démarrer/redémarrer apache i obtenir cette erreur

[email protected]:/etc/apache2# /etc/init.d/apache2 restart 
Syntax error on line 1 of /home/smau/Workspace/Maynard/tothego_frontend/srv/mod_wsgi/django.wsgi: 
Invalid command 'import', perhaps misspelled or defined by a module not included in the server configuration 
Action 'configtest' failed. 
The Apache error log may have more information. 
    ...fail! 

C'est /var/log/apache2.log

[Thu Jul 14 11:39:31 2011] [notice] Apache/2.2.17 (Ubuntu) PHP/5.3.5-1ubuntu7.2 
with Suhosin-Patch mod_wsgi/3.3 Python/2.7.1+ configured -- resuming normal operations 

[Thu Jul 14 11:44:28 2011] [notice] caught SIGTERM, shutting down 
PHP Warning: PHP Startup: Unable to load dynamic library 
'/usr/lib/php5/20090626/gd.so'- /usr/lib/php5/20090626/gd.so: cannot open shared object file: 
No such file or directory in Unknown on line 0 

Le journal ne semble pas (pour moi ...) en tout cas lié à mon problème. Pourquoi est-ce que je continue à obtenir l'erreur "d'importation"? Est-ce que je vous ai donné suffisamment d'informations ou avez-vous besoin d'autre chose? Je suppose que mon chemin pythonpath est correct:

Répondre

2

Vous êtes censé inclure le fichier de configuration (django.conf), pas le script WSGI (django.wsgi).

+0

c'est ce qui se passe quand vous travaillez trop, vous ne remarquez pas les plus petites erreurs triviales ... merci! –

Questions connexes