Apache 403 beim Bereitstellen von statischen Django-Dateien

Ich habe viele verwandte Beiträge durchgesehen, aber nichts scheint zu helfen.
Relevante Informationen:

Django-Version - 1.4

Apache Version - 2.2

Python-Version - 2.7

OS - Xubuntu 12.04

DB - Mysql

Ich versuche, Apache dazu zu bringen, sowohl die Django-App als auch statische Dateien bereitzustellen. Das Problem tritt auf der Admin-Site auf, auf der keine CSS-Stile oder -Bilder angezeigt werden. Meine Admin-Seite sieht momentan so aus:

(Nun, ich hätte ein Bild eingefügt, aber der Stapelüberlauf hat es mir nicht erlaubt. Es reicht zu sagen, dass es wie die Administrationsseite aller anderen aussieht, die zu diesem Thema gepostet habenApache liefert keine statischen Django-Admin-Dateien )

Anwendungselemente wie meine Anmeldeseite und einige dynamische Inhalte funktionieren einwandfrei, aber wenn ich versuche, statischen Inhalt bereitzustellen, wird eine 403-Fehlermeldung angezeigt. Außerdem, wenn ich versuche, manuell zum Stylesheet zu navigieren, indem ich die gerenderte HTML-Datei der Administratorseite betrachte und auf den Link zum Stylesheet unter klicke

http://localhost/static/admin/css/base.css 

Ich erhalte eine 403-Fehlermeldung. Ich kann dort in einem Terminal navigieren und die Berechtigungen für den Ordner so ändern, dass der WWW-Daten-Benutzer von Apache explizit auf alle Dateien zugreifen kann.

Hier sind die relevanten Teile meiner httpd.conf:

#AliasMatch ^/([^/]*\.css) /usr/local/wsgi/static/styles/$1

Alias /media/ "/usr/local/wsgi/media/"
Alias /static/ "/usr/local/wsgi/static/"

<Directory "/usr/local/wsgi/static">
Order deny,allow
Allow from all
</Directory>

<Directory "/usr/local/wsgi/media">
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias / "/home/noah/Documents/Web/Basic/apache/django.wsgi"

<Directory "/usr/local/wsgi/scripts">
Order allow,deny
Allow from all
</Directory>

Auf Anraten eines Freundes habe ich auch die oben genannten Standardeinstellungen auf meine Websites kopiert:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    TypesConfig /etc/mime.types
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /home/noah/Documents/Web/Basic/apache/ >
        Options -Indexes FollowSymLinks
            AllowOverride AuthConfig FileInfo
            Order allow,deny
            Allow from all
        </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>
    SetEnv DJANGO_SETTINGS_MODULE Basic.settings
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

#AliasMatch ^/([^/]*\.css) /usr/local/wsgi/static/styles/$1

Alias /media "/usr/local/wsgi/media/"
Alias /static "/usr/local/wsgi/static/"

<Directory "/usr/local/wsgi/static">
Order deny,allow
Allow from all
</Directory>

<Directory "/usr/local/wsgi/media">
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias / "/home/noah/Documents/Web/Basic/apache/django.wsgi"

<Directory "/usr/local/wsgi/scripts">
Order allow,deny
Allow from all
</Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

Hier ist mein django.wsgi

import os
import sys

path = '/home/noah/Documents/Web/Basic'
if path not in sys.path:
    sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'Basic.settings'

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

Und zum Schluss hier meine settings.py:

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = '/usr/local/wsgi/media/'

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = 'http://localhost/media/'

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = '/usr/local/wsgi/static/'

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = 'http://localhost/static/'

# Additional locations of static files
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'bmc&amp;epl=#u)r3elkvj#@90*cji*z^cg8dnh$7j9kh@g9wzw(ih'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    # Uncomment the next line for simple clickjacking protection:
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'Basic.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'Basic.wsgi.application'

Mein Django-Projekt 'Basic' befindet sich in ~ / Documents / Web /, das mit / var / www / verknüpft ist.

Jede Hilfe wird sehr geschätzt, und lassen Sie mich wissen, wenn Sie weitere Dateien / Informationen benötigen.

Antworten auf die Frage(3)

Ihre Antwort auf die Frage