I have two different django applications running on the same apache2.4 server. One of the sites is working, but the new one i am trying to set up is giving me this same error:
Target WSGI script 'C:/vault90/vault90/wsgi.py' does not contain WSGI application 'application'.
The file at this location looks like this however:
import os
import sys
import logging
import traceback
from django.core.wsgi import get_wsgi_application
# Add your project directory to the sys.path
sys.path.append('C:/vault90')
# Set the settings module for the project
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'vault90.settings')
# Setup logging for WSGI errors
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
try:
# Get the WSGI application
application = get_wsgi_application()
except Exception:
logger.error('WSGI failed to start', exc_info=True)
traceback.print_exc()
and this is my vhosts.conf:
<VirtualHost *:80>
ServerName example2.com
ServerAlias www.example2.com
DocumentRoot "C:/vault90"
# Point to the WSGI application
WSGIScriptAlias / C:/vault90/vault90/wsgi.py
LogLevel info wsgi:debug
<Directory C:/vault90/vault90>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
# Serve static files
Alias /static/ C:/vault90/static/
<Directory C:/vault90/static>
Require all granted
</Directory>
# Logs for debugging
ErrorLog "C:/Apache24/logs/vault90_error.log"
CustomLog "C:/Apache24/logs/vault90_access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot "C:/tbg"
# Point to the WSGI application
WSGIScriptAlias / C:/tbg/tbg/wsgi.py
LogLevel info wsgi:debug
<Directory C:/tbg/tbg>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
# Serve static files
Alias /static/ C:/tbg/static/
<Directory C:/tbg/static>
Require all granted
</Directory>
# Log files
ErrorLog "C:/Apache24/logs/tbg_error.log"
CustomLog "C:/Apache24/logs/tbg_access.log" common
</VirtualHost>
and my python path is here:
LoadFile "C:/Users/joeb/AppData/Local/Programs/Python/Python313/python313.dll"
LoadModule wsgi_module "C:/Users/joeb/AppData/Local/Programs/Python/Python313/Lib/site-packages/mod_wsgi/server/mod_wsgi.cp313-win_amd64.pyd"
WSGIPythonHome "C:/Users/joeb/AppData/Local/Programs/Python/Python313"
I am sorry this is not super organized. but happy to edit if there is feedback or more details i should provide to make this more a logical oriented issue to resolve.