亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

在Apache服務(wù)器上同時運行多個Django程序的方法

 更新時間:2015年07月22日 10:44:26   投稿:goldensun  
這篇文章主要介紹了在Apache服務(wù)器上同時運行多個Django程序的方法,Django是Python各色高人氣web框架中最為著名的一個,需要的朋友可以參考下

在同一個 Apache 實例中運行多個 Django 程序是完全可能的。 當你是一個獨立的 Web 開發(fā)人員并有多個不同的客戶時,你可能會想這么做。

只要像下面這樣使用 VirtualHost 你可以實現(xiàn):

NameVirtualHost *

<VirtualHost *>
  ServerName www.example.com
  # ...
  SetEnv DJANGO_SETTINGS_MODULE mysite.settings
</VirtualHost>

<VirtualHost *>
  ServerName www2.example.com
  # ...
  SetEnv DJANGO_SETTINGS_MODULE mysite.other_settings
</VirtualHost>

如果你需要在同一個 VirtualHost 中運行兩個 Django 程序,你需要特別留意一下以 確保 mod_python 的代碼緩存不被弄得亂七八糟。 使用 PythonInterpreter 指令來將不 同的 <Location> 指令分別解釋:

<VirtualHost *>
  ServerName www.example.com
  # ...
  <Location "/something">
    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
    PythonInterpreter mysite
  </Location>

  <Location "/otherthing">
    SetEnv DJANGO_SETTINGS_MODULE mysite.other_settings
    PythonInterpreter mysite_other
  </Location>
</VirtualHost>

這個 PythonInterpreter 中的值不重要,只要它們在兩個 Location 塊中不同。

相關(guān)文章

最新評論