【发布时间】:2021-09-01 16:23:18
【问题描述】:
我正在使用 ssh 在我的主机上设置我的 Django 项目。我正在关注一篇文章以便能够正确安装它。我必须遵循的一些步骤如下:
创建 . htaccess 文件,其中包含 FCGI 处理程序的设置并重定向到将创建的 index.fcgi 文件:
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.fcgi/$1 [QSA,L]
并在应用程序的根目录中创建 index.fcgi 文件,其中包含以下内容:
#!/home/CONTA/.virtualenv/bin/python
import os, sys
from flup.server.fcgi import WSGIServer
from django.core.wsgi import get_wsgi_application
sys.path.insert(0, "/home/CUENTA/mydjango")
os.environ['DJANGO_SETTINGS_MODULE'] = "mydjango.settings"
WSGIServer(get_wsgi_application()).run()
已经在公共 html 中拥有这两个文件并使用 chmod 0755 选择对 index.fcgi 的权限在我查看它是否正在使用以下命令运行时 ./ index.fcgi,告诉我没有文件或目录。
这让我假设我需要在 index.fcgi 或 . htaccess 但我不知道我需要更改什么,因为文章中只有那个。谢谢
【问题讨论】:
标签: python django apache .htaccess