I have a site that i want to launch. When using the ruserver command, the site works perfectly.
However, when I try to run it on the apache server, I get:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, email@domain.com and inform them of the time the error occurred, and anything开发者_开发技巧 you might have done that may have caused the error.
More information about this error may be available in the server error log.
looking at the log, sometimes it doesn't have anything new, sometimes it has:
[Mon May 02 10:21:21 2011] [error] [client 78.83.251.195] return do_translate(message, 'ugettext')
[Mon May 02 10:21:21 2011] [error] [client 78.83.251.195] File "/usr/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 270, in do_translate
[Mon May 02 10:21:21 2011] [error] [client 78.83.251.195] _default = translation(settings.LANGUAGE_CODE)
[Mon May 02 10:21:21 2011] [error] [client 78.83.251.195] File "/usr/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 180, in translation
[Mon May 02 10:21:21 2011] [error] [client 78.83.251.195] default_translation = _fetch(settings.LANGUAGE_CODE)
[Mon May 02 10:21:21 2011] [error] [client 78.83.251.195] File "/usr/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 163, in _fetch
[Mon May 02 10:21:21 2011] [error] [client 78.83.251.195] app = import_module(appname)
[Mon May 02 10:21:21 2011] [error] [client 78.83.251.195] File "/usr/lib/python2.6/dist-packages/django/utils/importlib.py", line 35, in import_module
[Mon May 02 10:21:21 2011] [error] [client 78.83.251.195] __import__(name)
[Mon May 02 10:21:21 2011] [error] [client 78.83.251.195] TemplateSyntaxError: Caught ImportError while rendering: No module named main
However, i do have module 'main' as a folder and as an application in the settings.py
as a matter of fact, if i comment out 'main' in the settings, it catches a similar error on the next 'app' until i have removed them all, when of course nothing works.
Here is the httpd.conf:
<VirtualHost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin email@domain.com
ServerName domain.com
ServerAlias domain.com
Alias /admin_media/ /usr/lib/python2.6/dist-packages/django/contrib/admin/media/
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html
DocumentRoot /var/www/domain.com/
# Custom log file locations
LogLevel warn
ErrorLog /var/www/domain.com/log/error.log
CustomLog /var/www/domain.com/log/access.log combined
# Setup mod_wsgi
WSGIScriptAlias / /var/www/domain.com/dispatch.wsgi
<Directory /var/www/domain.com >
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
what do i do?
In your apache httpd.conf
file, you have to ensure that your project path is in WSGIPythonPath
:
WSGIPythonPath /home/user/webapps/yourproject:/home/user/webapps/yourproject/project:/home/user/webapps/yourproject/lib/python2.7
I'm assuming your settings.py
is under project
:
/home/user/webapps/yourproject/project/settings.py
精彩评论