Windows Apache zwei Django-Projekte in getrenntem VenvApache

Apache verstehen
Anonymous
 Windows Apache zwei Django-Projekte in getrenntem Venv

Post by Anonymous »

Ich muss zwei getrennte Apps hosten, mit getrenntem Venv und getrennter Datenbank, um die Kosten zu senken. Beide Apps wurden separat entwickelt, jetzt habe ich nur noch einen einzigen Server, um sie zu hosten.
Kern läuft auf Port 80, Portal auf 8081
Ich kann irgendwann auf beide Apps zugreifen, remote, also außerhalb des Servers. Aber nach einiger Zeit kann ich, egal welchen Port ich bereitstelle, nur noch auf eine einzige App zugreifen. Anscheinend werden statische Dateien ordnungsgemäß bereitgestellt, da sich das ICO ändert, aber der Inhalt ist derselbe, sodass ich zum Beispiel Portal auf beiden Ports sehe.
Ich bin mir nicht sicher, was das auslöst und wie man es verhindert.
Hier sind meine Dateien.
D:\Apache24\conf\httpd.conf

Code: Select all

Define SRVROOT "d:/Apache24"
ServerRoot "${SRVROOT}"
Listen 10.192.28.86:80
Listen 10.192.28.86:8081
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule setenvif_module modules/mod_setenvif.so

User daemon
Group daemon

ServerAdmin [email protected]

AllowOverride none
Require all denied

DocumentRoot "${SRVROOT}/htdocs"

Options Indexes FollowSymLinks
AllowOverride None
Require all granted


DirectoryIndex index.html


Require all denied

ErrorLog "logs/error.log"
LogLevel debug

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

CustomLog "logs/access.log" common


ScriptAlias /cgi-bin/ "${SRVROOT}/cgi-bin/"




AllowOverride None
Options None
Require all granted


RequestHeader unset Proxy early


TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz


Include conf/extra/proxy-html.conf


SSLRandomSeed startup builtin
SSLRandomSeed connect builtin

LoadFile "D:/appl/prod_core/prod_env/Scripts/python39.dll"
LoadModule wsgi_module "D:/appl/prod_core/prod_env/lib/site-packages/mod_wsgi/server/mod_wsgi.cp39-win_amd64.pyd"
WSGIPythonHome "D:/appl/prod_core/core"
WSGIPythonPath "D:/appl/prod_core/prod_env/Lib/site-packages"
Include conf/extra/httpd-vhosts.conf
D:\Apache24\conf\extra\httpd-vhosts.conf

Code: Select all

    
ServerName servername:80
WSGIPassAuthorization On

ErrorLog "D:/Apache24/logs/apache.error.log"
CustomLog "D:/Apache24/logs/apache.access.log" combined

WSGIApplicationGroup %{GLOBAL}

WSGIScriptAlias /  "D:/appl/prod_core/core/core/wsgi.py"


Require all granted



Alias /static/ "D:/appl/prod_core/core/staticfiles/"

Require all granted


Alias /media "D:/appl/prod_core/core/media/"

Require all granted


TraceEnable off



ServerName servername:8081
WSGIPassAuthorization On

ErrorLog "D:/Apache24/logs/apache_project2.error.log"
CustomLog "D:/Apache24/logs/apache_project2.access.log" combined

# REQUIRED on Windows
WSGIApplicationGroup %{RESOURCE}

WSGIScriptAlias / "D:/appl/prod_portal/core/core/wsgi.py"


Require all granted



Alias /static/ "D:/appl/prod_portal/core/staticfiles/"

Require all granted


Alias /media/ "D:/appl/prod_portal/core/media/"

Require all granted


TraceEnable off

portal wsgi.py und core wsgi.py sind nicht dieselbe Datei, sie sind durch sie getrennt und haben denselben Inhalt.

Code: Select all

import os
import sys
from django.core.wsgi import get_wsgi_application
from pathlib import Path

# Add project directory to the sys.path
path_home = str(Path(__file__).parents[1])

if path_home not in sys.path:
sys.path.append(path_home)
# Add the app’s directory to the PYTHONPATH

os.environ['DJANGO_SETTINGS_MODULE'] = 'core.settings'
#os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')

application = get_wsgi_application()
env-Ordner
D:/appl/prod_core/prod_env/
D:/appl/prod_portal/prod_env/
Vielen Dank.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post