408 код состояния при проверке журналов доступа django на apache с использованием mod_wsgi в windows - PullRequest
0 голосов
/ 11 марта 2020

один - это php сайт, а другой - django проект. Php сайт работает нормально, но не django проект. Он работает нормально на локальном сервере выполнения, но не на apache. Я следовал

<VirtualHost *:8086>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName localhost 
    WSGIPassAuthorization On
    ErrorLog "C:/Users/smac/fbextractor/fbextractor.error.log"
    CustomLog "C:/Users/smac/fbextractor/fbextractor.access.log" combined
    WSGIScriptAlias /  "C:\Users\smac\fbextractor\fbextractor\wsgi_windows.py"
   <Directory "C:/Users/smac/fbextractor">
        Require all granted
    </Directory>
 <Directory "C:\Users\smac\fbextractor\fbextractor">
        <Files wsgi_windows.py>
            Require all granted
        </Files>
    </Directory>

    Alias /media "C:/Users/smac/fbextractor/media"
    <Directory "C:/Users/smac/fbextractor/media">
        Require all granted
    </Directory>
</VirtualHost>

settings.py

"""
Django settings for fbextractor project.

Generated by 'django-admin startproject' using Django 2.1.7.

For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '7(7=3n5ib%=@1i6qd!d&%z!!x0ij@yh3&yf#5400e(#%dl@z@)'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['localhost','10.147.41.64','10.147.41.44','14.139.55.130','dj.localhost']


# Application definition

INSTALLED_APPS = [
    'extract_friends.apps.ExtractFriendsConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'twiiter',
    'multiforloop'
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'fbextractor.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],

            'libraries': {
                'multifor': 'twiiter.templatetags.multifor',

            }
        },
    },
]

WSGI_APPLICATION = 'fbextractor.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'twitter',
        'USER': 'root',
        'PASSWORD': '',
        'HOST': 'localhost',
        'PORT': 3306
    }
}


# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'

wsgi_ windows .py:

import os
import sys
import site
from django.core.wsgi import get_wsgi_application

# add python site packages, you can use virtualenvs also
site.addsitedir("C:/Python/Python37/Lib/site-packages")

# Add the app's directory to the PYTHONPATH 
sys.path.append('C:/Users/smac/fbextractor') 
sys.path.append('C:/Users/smac/fbextractor/fbextractor')  

os.environ['DJANGO_SETTINGS_MODULE'] = 'fbextractor.settings' 
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fbextractor.settings")  

application = get_wsgi_application()

I все перепробовал но ничего не работает Помогите? Заранее спасибо.

...