1👍
The key to my problem was identifying how to override Passenger, which is what is running the Django app. Access your httpd.conf file. Within the main Virtualhost section (the one that defines your domain and how the public folder is handled) place this code to override Passenger and Django’s grip on the /* directory.
Alias /blog /home/user/domain/public/blog
<Directory /home/user/domain/public/blog>
PassengerEnabled off
AllowOverride all
Order Deny,Allow
Allow from all
</Directory>
Adding PassengerEnabled off
takes care of Passenger and allows the Directory to be served outside of the Django app. I don’t think AllowOverride or Allow from all does much of anything but I left it in just to be safe. Works perfectly now.
3👍
Try adding an Apache Alias directive:
Alias /blog/ /home/user/domain/public/blog/
That ‘Alias’ will along with your ‘Directory’ directive should do the trick.
Note: I have these listed before my wsgi configuration that loads django into apache. ( I dont know if that matters tho, but it might.)
Edit:
In my main httpd. conf file I
LoadModule wsgi_module modules/mod_wsgi.so
I assume there are ‘DocumentRoot’ and ‘Directory’ directives in there.
Next: in my virtual host
<VirtualHost *:80>
Alias /blog/ /home/user/domain/public/blog/
<FilesMatch \.(?i:gif|jpe?g|png|ico)$>
Order allow,deny
allow from all
</FilesMatch>
<FilesMatch \.(?i:css|jst|js|txt|htm|html)$>
Options Indexes FollowSymLinks MultiViews
Order allow,deny
allow from all
</FilesMatch>
<Directory /home/user/domain/public/blog/>
Order allow,deny
allow from all
</Directory>
Maybe my FilesMatch directives were actually doing the magic ( I might have missed that before)
Debugging
If you cant get this going, you might want to enable more verbose httpd logging output in apache to see if you can get it to tell you what it is unhappy about.
you do this by changing the ‘LogLevel’ directive from ‘warn’ to debug
LogLevel debug
now
tail -f /path/to/you/apache/error_logs
- [Django]-Django User model UpdateView "No URL to redirect to"
- [Django]-I want to represent django model as table in html page with table heading same as django field name. How can I implement this?