2011-07-14 3 views
0

に(私は開発効率向上のENVでも、これを使用したい)のmod_wsgiの構文エラー:私は私のDjangoのメディアファイルを提供するために、セットアップのmod_wsgiにしようとしている「無効なコマンドのインポート」

私が正しくセットアップのmod_wsgiにthis guideを追いました。

これはこれはこれは私の "httpd.confの" ある私のconfファイル( "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> 

である私のWSGIファイル( "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() 

です

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

私は/私はこのエラーを取得Apacheを再起動して起動しようとするすべては、しかし、ガイドのようであるように思わ

[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! 

これは、ログはとにかく私の問題に関連した(...私には)いないようだ

[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 

を/var/log/apache2.logています。なぜ私は "インポート"エラーを取得し続けますか?私はあなたに十分な情報を提供しましたか、他に何か必要がありますか?私はpythonpathが正しいと思います:

答えて

2

WSGIスクリプト(django.wsgi)ではなく、設定ファイル(django.conf)を含めることになっています。

+0

あなたはあまりにも多くの仕事をしたときに起こることですが、あなたは最小の些細なエラーに気付かない...ありがとう! –

関連する問題