2015-07-03 28 views
0

我試圖用Django和PHP製作本地服務器,我想在其他計算機上訪問。我試圖創建兩個文件夾,一個與django文件和其他名爲PHP的PHP文件命名Django。我是初學者在Apache和到現在爲止我只作了這樣的:如何在Django1.8中配置Apache以及在服務器中使用PHP Debian

/etc/apache2/sites-available/etc/apache2/sites-available/000-default.conf:

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    DocumentRoot /var/www 

    <Directory /> 
      Options FollowSymLinks 
      AllowOverride None 
    </Directory> 
    <Directory /var/www/> 
      Options Indexes FollowSymLinks MultiViews 
      AllowOverride None 
      Order allow,deny 
      allow from all 
    </Directory> 

    WSGIScriptAlias//var/www/wsgi_test/app.wsgi 
    <Directory /var/www/wsgi_test/> 
     Require all granted 
     Order allow,deny 
     Allow from all 
    </Directory> 


    ErrorLog ${APACHE_LOG_DIR}/error.log 
    CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost> 

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet 

應用。 WSGI:

def application(environ, start_response): 
status = '200 OK' 
output = 'Hello World!' 
response_headers = [('Content-type', 'text/plain'), 
        ('Content-Length', str(len(output)))] 
start_response(status, response_headers) 
return [output] 

我可以在本地主機(10.1.1.20)訪問,以及任何子域的其他計算機,例如:10.1.1.20/whatever打開的「Hello World」的文件,但我想訪問我的文件夾中的Django ,但它顯示「Hello World」

// UPDATE

我解決與以下的答案:Django and PHP together in server with single ip and port only

+0

Fox混合PHP和mod_wsgi也讀取http://blog.dscpl.com.au/2014/09/hosting-php-web-applications-in.html –

+0

@GrahamDumpleton謝謝! –

回答

0

您指定的是世界你好WSGI文件作爲WSGI文件。你將不得不使用django wsgi文件來訪問django。

該文件可在您的項目目錄下找到project_name/wsgi.py(即與項目設置位於同一文件夾中)。

相關問題