【问题标题】:Run django in https://example.org/directory - python and php在 https://example.org/directory 中运行 django - python 和 php
【发布时间】:2016-05-31 01:04:31
【问题描述】:

我有一个网站 https://example.org (HTTPS) 和 php, Apache2 。我需要在同一台服务器(Centos 6)上运行一个 Django 应用程序。

可以在https://example.org/my_django_app/执行django app吗?

我可以在子域(http://my_django_app.example.org/)中执行,这里的问题是我需要为子域购买另一个证书。

回答

在 Virtualhost 配置 (Apache 2.2 ) 中,更改正常配置

WSGIScriptAlias / /my/route/wsgi.py

指定目录名称。

WSGIScriptAlias /directory /my/route/wsgi.py

您的 Django 项目在 https://example.org/directory 中运行,您的 https://example.org 执行 php

【问题讨论】:

  • 你用的是什么版本的apache?只需像他们在这里一样使用别名:digitalocean.com/community/tutorials/…
  • @LiamSorsby 我的 Apache2 版本是 2.2.31
  • 你试过在你的 apache conf 中使用别名吗?
  • 在 WSGIScriptAlias 中指定目录名称。谢谢@LiamSorsby
  • 没问题。将此添加为您自己问题的答案,并将其标记为已接受,而不是在您的问题中。

标签: python django apache2 virtualhost django-wsgi


【解决方案1】:

编辑虚拟主机配置,添加python配置

WSGIDaemonProcess inti python-path=/path/to/myproject:/path/to/env/lib/python2.7/site-packages
WSGIProcessGroup inti
WSGIScriptAlias /directory /path/to/wsgi.py

【讨论】:

    猜你喜欢
    • 2021-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-25
    • 2021-11-07
    • 1970-01-01
    • 2012-10-17
    • 2016-07-17
    相关资源
    最近更新 更多