Django在乘客显示空主页上的应用程序

2024-06-28 19:23:50 发布

您现在位置:Python中文网/ 问答频道 /正文

在我的本地环境中,由python manage.py runserver
我可以正常访问我的http://localhost:8000中的应用程序主页

在passenger上,我可以在远程域中使用系统的某些端点,但无法访问http://my.domain.com/http://my.domain.com。它显示一个空白页,因为在我的本地环境中,我通常可以看到主页。你知道吗

然后我创建了另一个端点来显示我的主页、检查静态文件等等,比如:
http://localhost:8000/h

在passenger中,我通常可以看到http://my.domain.com/h作为我的主页,但我无法真正在域的根目录中看到主页(如在任何其他网站中):http://my.domain.com

在我的网址我尝试了很多,但没有成功。你知道吗

我的django项目在公用文件夹中。这是我为乘客准备的文件夹结构。你知道吗

/path/to/project/public
/path/to/project/passenger_wsgi.py
/path/to/project/tmp/restart.txt

我怎样才能让这个家在http://my.domain.com里工作?你知道吗

欢迎任何帮助


Tags: topathpyproject文件夹comlocalhosthttp
1条回答
网友
1楼 · 发布于 2024-06-28 19:23:50

很清楚。你知道吗

Docs中所述

The "public" subdirectory Passenger maps the directory named "public" to be the document root for your domain/subdomain.
If a static HTML file named "public/index.html" exists, it's then used as the response for requests for the root document (i.e., "/").
If you want your application to handle requests for the root document, then you must first remove "public/index.html" (if it exists).
By default, Ruby on Rails creates a static "public/index.html" file.

在这个世贸论坛浪费了我几个小时的时间。你知道吗

相关问题 更多 >