python - Obtaining void template passing from django development server to apache server -


i've django app works under django development server. i'm trying run under apache2.2 using mod_wsgi.
in httpd.conf file of apache i've added:

<ifmodule wsgi_module>     wsgiscriptalias /index my_path_to_wsgi_modules/django.wsgi </ifmodule> 

and django.wsgi module contains basic configuration explained in django documentation: http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/
unfortunately when run server , try access main page obtain template page without variable data in it. server log says:

[fri feb 18 13:50:33 2011] [error] [client 127.0.0.1] file not exist: /usr/local/apache2/htdocs/api, referer: http://127.0.0.1/example/ 


said before strange thing same code works under django development server. i'm new in programming web app, please, can help?

my django.wsgi file looks this:

import os import sys

from os.path import sep

basepath = '/home/example/workspace/examplews/src'

sys.path.append(basepath)
sys.path.append('/home/example/workspace/examplews/src/examplews')

os.environ['django_settings_module'] = 'examplews.settings'

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

and httpd.con file, this:

serverroot "/usr/local/apache2"

listen 80

loadmodule wsgi_module modules/mod_wsgi.so

user apache
group apache

serveradmin example@domain.com

documentroot "/usr/local/apache2/htdocs"

<directory />
options followsymlinks
allowoverride none
order deny,allow
deny all
</directory>

<directory "/usr/local/apache2/htdocs">
options indexes followsymlinks

allowoverride none

order allow,deny
allow

</directory>

<ifmodule dir_module>
directoryindex index.html index.php index.sh default.jsp
</ifmodule>

<filesmatch "^\.ht">
order allow,deny
deny all
satisfy all
</filesmatch>

errorlog "logs/error_log"

loglevel warn

<ifmodule log_config_module>
logformat "%h %l %u %t \"%r\" %>s %b \"%{referer}i\" \"%{user-agent}i\"" combined
logformat "%h %l %u %t \"%r\" %>s %b" common

<ifmodule logio_module>
logformat "%h %l %u %t \"%r\" %>s %b \"%{referer}i\" \"%{user-agent}i\" %i %o" combinedio
</ifmodule>
customlog "logs/access_log" common

</ifmodule>

<ifmodule alias_module>
</ifmodule>

<ifmodule cgid_module>
</ifmodule>

<ifmodule wsgi_module>
wsgiscriptalias /main /home/example/workspace/examplews/src/examplews/apache_conf/django.wsgi
</ifmodule>
<directory "/home/example/workspace/examplews/src/examplews/apache_conf">
order allow,deny
allow all
</directory>
defaulttype text/plain

<ifmodule mime_module>
typesconfig conf/mime.types
addtype application/x-compress .z
addtype application/x-gzip .gz .tgz
</ifmodule>

<ifmodule ssl_module>
sslrandomseed startup builtin
sslrandomseed connect builtin
</ifmodule>

finally found error. not connected httpd.conf file how urls specified both django urls.py file , templates.
mounted myapp in way:

wsgiscriptalias /myapp my_path_to_wsgi_module/django.wsgi 

i believing urls specified in django template files should carry initial slash, this: '/api/dir'
results in way application works on django development server not on apache.

instead if use urls without initial slash like:
'api/dir'
app works correctly both on django development server , on apache!

must avoid using starting slashes on pattern matching of django urls.py file:
this: (r'^api/dir$', 'available_services')
, not this: (r'^/api/dir$', 'available_services')

maybe obvious thing expert django users if you're novice me, can make loose amount of time because it's hard problem detected.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -