Код: Выделить всё
D:\dev\htdocs # Apache HTTPD DocumentRoot
├───... # Other directories
│
└───nutrihub_pyvenv # venv container for Django project
├───.venv # I use pipenv
│
└───nutrihub
│ db.sqlite3
│ manage.py
│ Pipfile
│ Pipfile.lock
│
└───nutrihub
asgi.py
settings.py
urls.py
wsgi.py
__init__.py
Код: Выделить всё
LoadFile "c:/Python312/python312.dll"
LoadModule wsgi_module "d:/dev/htdocs/nutrihub_pyvenv/.venv/Lib/site-packages/mod_wsgi/server/mod_wsgi.cp312-win_amd64.pyd"
WSGIScriptAlias /nhub "d:/dev/htdocs/nutrihub_pyvenv/nutrihub/nutrihub/wsgi.py"
WSGIPythonHome "d:/dev/htdocs/nutrihub_pyvenv/.venv"
WSGIPythonPath "d:/dev/htdocs/nutrihub_pyvenv/nutrihub;"
WSGIApplicationGroup %{GLOBAL}
Require all granted
Код: Выделить всё
D:\dev\htdocs\nutrihub_pyvenv\nutrihub\nutrihub\settings.pyКод: Выделить всё
DEBUG = True
ALLOWED_HOSTS = ['*', 'localhost', '127.0.0.1']
Код: Выделить всё
D:\dev\htdocs\nutrihub_pyvenv\nutrihub
(.venv) λ py manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
March 26, 2024 - 06:56:13
Django version 5.0.3, using settings 'nutrihub.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Но при запуске моего Apache HTTPD и зайдя на http://localhost/nhub, я вижу сообщение:
Код: Выделить всё
Page not found (404)
Request Method: GET
Request URL : http://localhost/nhub/
Using the URLconf defined in nutrihub.urls, Django tried these URL patterns, in this order:
admin/
The empty path didn’t match any of these.
You’re seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
Код: Выделить всё
WSGIScriptAlias / "d:/dev/htdocs/nutrihub_pyvenv/nutrihub/nutrihub/wsgi.py"
Я хотел бы знать, что Я пропускаю WSGIScriptAlias как /nhub.
Этот вопрос не является дубликатом Django. Текущий URL-адрес не соответствует ни одному из это было предложено SO, поскольку этот вопрос и ответ сравнивают, почему при разных WSGIScriptAlias результаты различаются. Я уже нашел ответ и задокументировал его для тех, кто будет изучать Django в будущем.
Подробнее здесь: https://stackoverflow.com/questions/782 ... ias-is-not
Мобильная версия