1) Is is possible to set up mod_wsgi for django in an .htaccess file?
(AllowOverride All is set and mod_wsgi is loaded)
2) I want to set up django for / of my virtual host but take some
directories out (for example /forum/ is served my mod_php). How can I
do that?
Thanks,
Florian
This is documented in:
http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines
See end of section on 'The Apache Alias Directive' where it gives
examples with AddHandler and notes need to use mod_rewrite to get file
based resource script to appear as mounted on root of site.
So try that. If you have problems then explain exactly what
configuration you tried to use in the .htaccess script and what the
WSGI script contained so can verify you actually followed the
documentation.
Graham
Ok, I started it. But as soon as I put the line:
Alias /wsgi/ /home/flindner/xgm-django/apache/
in my .htaccess (this is only line in the file) I get an error:
/home/flindner/xgm.de/pub/.htaccess: Alias not allowed here
though I have
<Directory *>
AllowOverride All
Options -Indexes
</Directory>
in my main apache 2 config and mod_alias is loaded.
Any idea?
Thanks,
Florian
Alias directives must be in the main Apache configuration file.
Why are you not mounting it on / like you said you wanted to anyway.
> in my .htaccess (this is only line in the file) I get an error:
>
> /home/flindner/xgm.de/pub/.htaccess: Alias not allowed here
>
> though I have
>
> <Directory *>
> AllowOverride All
> Options -Indexes
> </Directory>
I would recommend against allowing overrides for all directories. Just
enable it for directories where you need it.
> in my main apache 2 config and mod_alias is loaded.
>
> Any idea?
Based on above, in main Apache configuration file you want:
Alias / /home/flindner/xgm-django/apache/
<Directory /home/flindner/xgm-django/apache>
AllowOverride FileInfo
Order deny,allow
Allow from all
</Directory>
In the .htaccess file in that directory, you would then have:
AddHandler wsgi-script .wsgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /site.wsgi/$1 [QSA,PT,L]
Call your WSGI script file 'site.wsgi' and put it in same directory as
the .htaccess file.
This will only be used where a physical file doesn't otherwise exist
with that directory tree.
I'll try and make the documentation clearer that all examples up to
the .htaccess example only work in main Apache configuration.
Graham
Graham
I suppose it must be placed in an VirtualHost section? Is there any
way to not modify the existing virtual host entry? Background: I have
a tool that generates the virtual host configuration from a database
and uses a static template for this. I would like to omit taking the
virtual host out of DB because there are some other generated too from
this entry. Can I modify an existing virtual host entry in the config,
for example?
Thanks a lot!
Florian
You only need this in main Apache configuration if you want to have
your stuff in a place separate to your document root for that
VirtualHost (or server).
If your DocumentRoot already has at least 'AllowOverride FileInfo',
then you can just put your stuff in the DocumetRoot directory and
modify the .htaccess file there.
You aren't really going into enough detail about what you are auto
generating, what it looks like and where you expect files to live, for
me to be able to comment further. Sorry.
Graham