簡體   English   中英

Django和apache2重新啟動

[英]Django and apache2 restart

我嘗試使用apache設置Django時遇到以下問題:

$ sudo /etc/init.d/apache2 restart
 * Restarting web server apache2
[Wed Mar 07 03:21:17 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
 ... waiting [Wed Mar 07 03:21:18 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
   ...done.

有什么想法會導致這種情況嗎?

這是sites-available文件的內容:

NameVirtualHost *:80

              <VirtualHost *:80>
              ServerAdmin admin@website.com
              ServerName www.website.com
              ServerAlias website.com

              Alias /static /home/website/store/static

              DocumentRoot /home/website/store
              WSGIScriptAlias / /home/website/store/apache/django.wsgi

              ErrorLog /var/log/apache2/error.log

              LogLevel warn
              CustomLog /var/log/apache2/access.log combined
              </VirtualHost>

這也是wsgi文件:

import os, sys

#path to directory of the .wsgi file ('apache/')
wsgi_dir= os.path.abspath(os.path.dirname(__file__))

#path to project root directory (parent of 'apache/')
project_dir=os.path.dirname(wsgi_dir)

#add project directory to system's PATH
sys.path.append(project_dir)

project_settings=os.path.join(project_dir,'settings')
os.envision['DJANGO_SETTINGS_MODULE']='store.settings'

import django.core.handlers.wsgi
application=django.core.handlers.wsgi.WSGIHandler()

此錯誤與Apache有關,與django無關。

如果您正在進行開發,則不需要apache。 使用內置的開發服務器來滿足您的需求。

由於您使用的是基於debian的系統,請參閱本文 ,其中說明了在debian上設置多個主機的正確方法(如果您使用的是其他基於debian的系統(如各種ubuntu風味),則正確。 如果您想了解有關虛擬主機的更多信息(無論如何都應該閱讀), 虛擬主機文檔中有許多示例。

從內存中這是由於NameVirtualHost在Apache配置中的多個位置具有相同的值而引起的。 通常,在站點可用目錄中的站點文件中不會包含該指令,因為Apache配置的單獨部分中的端口80已經存在該指令。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM