I am using django 4.0 with Apache and mod_wsgi. Whenever I try request the 
site through apache, I get the following error:
[Wed Dec 15 14:51:59.385259 2021] [wsgi:info] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654] mod_wsgi (pid=15535, 
process='traveldata', application='127.0.1.1|'): Loading Python script file 
'/home/kyle/active-travel/traveldata/traveldata/wsgi.py'.
[Wed Dec 15 14:51:59.385699 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654] mod_wsgi (pid=15535): Failed to 
exec Python script file 
'/home/kyle/active-travel/traveldata/traveldata/wsgi.py'.
[Wed Dec 15 14:51:59.385718 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654] mod_wsgi (pid=15535): Exception 
occurred processing WSGI script 
'/home/kyle/active-travel/traveldata/traveldata/wsgi.py'.
[Wed Dec 15 14:51:59.385800 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654] Traceback (most recent call last):
[Wed Dec 15 14:51:59.385828 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File 
"/home/kyle/active-travel/traveldata/traveldata/wsgi.py", line 19, in 
<module>
[Wed Dec 15 14:51:59.385831 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]     application = 
django.core.handlers.wsgi.WSGIHandler()
[Wed Dec 15 14:51:59.385836 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File 
"/home/kyle/active-travel/venv/lib/python3.8/site-packages/django/core/handlers/wsgi.py",
 
line 127, in __init__
[Wed Dec 15 14:51:59.385838 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]     self.load_middleware()
[Wed Dec 15 14:51:59.385842 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File 
"/home/kyle/active-travel/venv/lib/python3.8/site-packages/django/core/handlers/base.py",
 
line 39, in load_middleware
[Wed Dec 15 14:51:59.385844 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]     for middleware_path in 
reversed(settings.MIDDLEWARE):
[Wed Dec 15 14:51:59.385847 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File 
"/home/kyle/active-travel/venv/lib/python3.8/site-packages/django/conf/__init__.py",
 
line 84, in __getattr__
[Wed Dec 15 14:51:59.385849 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]     self._setup(name)
[Wed Dec 15 14:51:59.385859 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File 
"/home/kyle/active-travel/venv/lib/python3.8/site-packages/django/conf/__init__.py",
 
line 71, in _setup
[Wed Dec 15 14:51:59.385861 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]     self._wrapped = 
Settings(settings_module)
[Wed Dec 15 14:51:59.385864 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File 
"/home/kyle/active-travel/venv/lib/python3.8/site-packages/django/conf/__init__.py",
 
line 179, in __init__
[Wed Dec 15 14:51:59.385866 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]     mod = 
importlib.import_module(self.SETTINGS_MODULE)
[Wed Dec 15 14:51:59.385869 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File 
"/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
[Wed Dec 15 14:51:59.385871 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]     return 
_bootstrap._gcd_import(name[level:], package, level)
[Wed Dec 15 14:51:59.385875 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File "<frozen 
importlib._bootstrap>", line 1014, in _gcd_import
[Wed Dec 15 14:51:59.385878 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File "<frozen 
importlib._bootstrap>", line 991, in _find_and_load
[Wed Dec 15 14:51:59.385882 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File "<frozen 
importlib._bootstrap>", line 961, in _find_and_load_unlocked
[Wed Dec 15 14:51:59.385886 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File "<frozen 
importlib._bootstrap>", line 219, in _call_with_frames_removed
[Wed Dec 15 14:51:59.385889 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File "<frozen 
importlib._bootstrap>", line 1014, in _gcd_import
[Wed Dec 15 14:51:59.385893 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File "<frozen 
importlib._bootstrap>", line 991, in _find_and_load
[Wed Dec 15 14:51:59.385896 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654]   File "<frozen 
importlib._bootstrap>", line 973, in _find_and_load_unlocked
[Wed Dec 15 14:51:59.385905 2021] [wsgi:error] [pid 15535:tid 
140431892707072] [remote 127.0.0.1:44654] ModuleNotFoundError: No module 
named 'traveldata'
[Wed Dec 15 14:51:59.422414 2021] [authz_core:error] [pid 15536:tid 
140431673259776] [client 127.0.0.1:44656] AH01630: client denied by server 
configuration: /home/kyle/active-travel/static, referer: http://localhost/

Settings.py:
"""
Django settings for traveldata project.

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

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

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

from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 
'django-insecure-dsthvt6peb39hc+cv$_#utk#l&sc5z(xp36+_ku%4$q*+(+5^j'

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

ALLOWED_HOSTS = ['127.0.0.1']


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'index.apps.IndexConfig',
'pedestrianCrossings.apps.PedestriancrossingsConfig',
]

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 = 'traveldata.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR / 'templates'],
'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',
],
},
},
]

WSGI_APPLICATION = 'traveldata.wsgi.application'


# Database
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}


# Password validation
# 
https://docs.djangoproject.com/en/4.0/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/4.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'static'

# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

wsgi.py:
import os, sys

from django.conf import settings

sys.path.append('home/kyle/active-travel/venv/lib/python3.8/site-packages')

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

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ad60725b-fe01-4cb1-8609-2a1ae169c719n%40googlegroups.com.

Reply via email to