I'm new to web servers, so please be gentle:
I've set up a new apache2 server on a Mint System (Ubuntu-base, which also means Debian-based). I've also installed a Django backend and the wsgi_mod extension. I'm just serving from localhost for testing purposes.
The Django admin interface (accessible with
localhost/admin/) refers to its css file with a relative URL like
static/admin/base.css. Now I see in my apache logs that the browser is trying to fetch it under the full URL
localhost/admin/static/admin/base.css, which doesn't exist.
I was under the impression that relative paths are always resolved by appending them to the basename, not the current URL. (Which would lead to
localhost/static/admin/base.css, which is where the file actually IS).
Have I thought wrong (and my Django settings are mixed up), or have I miss-configured my apache server? The following would be my 000-default file in site-enabled folder:
<VirtualHost *:80> ServerName localhost ServerAlias 127.0.1.1 ServerAdmin webmaster@localhost DocumentRoot "/home/web/http/80/localhost/htdocs" ErrorLog "/home/web/http/80/localhost/logs/error.log" CustomLog /home/web/http/80/localhost/logs/access.log combined LogLevel warn WSGIScriptAlias / /home/web/http/80/localhost/lib/app.wsgi Alias /robots.txt /home/web/http/80/localhost/htdocs/robots.txt Alias /favicon.ico /home/web/http/80/localhost/htdocs/favicon.ico Alias /images /home/web/http/80/localhost/htdocs/images Alias /static /home/web/http/80/localhost/htdocs/static <Directory /home/web/http/80/localhost/htdocs/> AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost>
I haven't changed anything in apache2.conf, ports.conf, envar or wsgi.conf. For testing purposes, my .htaccess file is also empty.
The relavant (?) part of my settings.py looks like this:
STATIC_ROOT = '/home/web/http/80/localhost/htdocs/static/' STATIC_URL = 'static/' # Additional locations of static files STATICFILES_DIRS = () ROOT_URLCONF = 'osmmap.urls' # Python dotted path to the WSGI application used by Django's runserver. WSGI_APPLICATION = 'osmmap.wsgi.application'
while this is my urls.py:
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: url(r'^test/', 'testapp.views.home'), # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), )