Reputation: 1253
I'm trying to deploy my new Django website onto an Apache2 server (running on a raspberry pi). Apache is running, and able to talk my app, but it isn't working properly; it's giving me a "Template not found error." It's trying to find the template/templates/main.html
from my what I'm guessing is my drive root,
I was using the runserver
command to develop everything and it was working perfectly. What I think the issue is that apache server is not running the WSGI script from the base of my application.
This is my hierarchy:
/var/www/website/
/var/www/website/website/
/var/www/website/templates
(they are shared between site apps)TEMPLATE_DIRS
has os.path.abspath('templates')
in it (which worked for development)WSGIScriptAlias / /var/www/website/website/wsgi.py
in httpd.conf
file.WSGIPythonPath /var/www/website
in http.conf
file.wsgi.py
file; isn't changed at all.And Here is my site-available/default
file:
<VirtualHost website.net:80>
<Directory /var/www/website/website>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
ErrorLog ${APACHE_LOG_DIR}/website_error.log
CustomLog ${APACHE_LOG_DIR}/website_access.log combined
</VirtualHost>
Any help is appreciated
Upvotes: 0
Views: 616
Reputation: 1253
I wrote a tutorial on how to deploy Django w/ Apache and mod_wsgi. I figured if I was having troubles figuring it so, others probably are. It was written about two weeks back. If there are any corrections anyone wants to make on it, please tell me.
http://16bpp.net/pages/how-to-deploy-a-django-app-with-apache
Upvotes: 1
Reputation: 58523
You cannot use os.path.abspath(). It relies on what the value of the current working directory is, which will not work under Apache. Go read:
Upvotes: 1