2013-07-03 81 views
0

我已經配置了的Apache2和mod_wsgi的一個的Linode服務器..與Apache2的服務Django應用程序+ mod_wsgi的

  1. 服務器運行的是
  2. WSGI運行
  3. postgre運行和執行syncdb成功

我有麻煩整理實際上是服務應用程序..

我的文件結構:

. 
├── logfile 
└── srv 
    ├── logfile 
    └── www 
     └── quickerhub.com 
      ├── admin 
      │   ├── css 
      │   │   ├── base.css 
      │   │   ├── changelists.css 
      │   │   ├── dashboard.css 
      │   │   ├── forms.css 
      │   │   ├── ie.css 
      │   │   ├── login.css 
      │   │   ├── rtl.css 
      │   │   └── widgets.css 
      │   ├── img 
      │   │   ├── changelist-bg.gif 
      │   │   ├── changelist-bg_rtl.gif 
      │   │   ├── chooser-bg.gif 
      │   │   ├── chooser_stacked-bg.gif 
      │   │   ├── default-bg.gif 
      │   │   ├── default-bg-reverse.gif 
      │   │   ├── deleted-overlay.gif 
      │   │   ├── gis 
      │   │   │   ├── move_vertex_off.png 
      │   │   │   └── move_vertex_on.png 
      │   │   ├── icon_addlink.gif 
      │   │   ├── icon_alert.gif 
      │   │   ├── icon_calendar.gif 
      │   │   ├── icon_changelink.gif 
      │   │   ├── icon_clock.gif 
      │   │   ├── icon_deletelink.gif 
      │   │   ├── icon_error.gif 
      │   │   ├── icon-no.gif 
      │   │   ├── icon_searchbox.png 
      │   │   ├── icon_success.gif 
      │   │   ├── icon-unknown.gif 
      │   │   ├── icon-yes.gif 
      │   │   ├── inline-delete-8bit.png 
      │   │   ├── inline-delete.png 
      │   │   ├── inline-restore-8bit.png 
      │   │   ├── inline-restore.png 
      │   │   ├── inline-splitter-bg.gif 
      │   │   ├── nav-bg.gif 
      │   │   ├── nav-bg-grabber.gif 
      │   │   ├── nav-bg-reverse.gif 
      │   │   ├── nav-bg-selected.gif 
      │   │   ├── selector-icons.gif 
      │   │   ├── selector-search.gif 
      │   │   ├── sorting-icons.gif 
      │   │   ├── tool-left.gif 
      │   │   ├── tool-left_over.gif 
      │   │   ├── tool-right.gif 
      │   │   ├── tool-right_over.gif 
      │   │   ├── tooltag-add.gif 
      │   │   ├── tooltag-add_over.gif 
      │   │   ├── tooltag-arrowright.gif 
      │   │   └── tooltag-arrowright_over.gif 
      │   └── js 
      │    ├── actions.js 
      │    ├── actions.min.js 
      │    ├── admin 
      │    │   ├── DateTimeShortcuts.js 
      │    │   ├── ordering.js 
      │    │   └── RelatedObjectLookups.js 
      │    ├── calendar.js 
      │    ├── collapse.js 
      │    ├── collapse.min.js 
      │    ├── core.js 
      │    ├── getElementsBySelector.js 
      │    ├── inlines.js 
      │    ├── inlines.min.js 
      │    ├── jquery.init.js 
      │    ├── jquery.js 
      │    ├── jquery.min.js 
      │    ├── LICENSE-JQUERY.txt 
      │    ├── prepopulate.js 
      │    ├── prepopulate.min.js 
      │    ├── SelectBox.js 
      │    ├── SelectFilter2.js 
      │    ├── timeparse.js 
      │    └── urlify.js 
      ├── interest 
      │   ├── django.wsgi 
      │   ├── __init__.py 
      │   ├── __init__.pyc 
      │   ├── settings.py 
      │   ├── settings.pyc 
      │   ├── urls.py 
      │   └── wsgi.py 
      ├── js 
      │   └── jquery-1.10.1.min.js 
      ├── logfile 
      ├── manage.py 
      ├── README 
      ├── reoccurring 
      │   ├── admin.py 
      │   ├── forms.py 
      │   ├── __init__.py 
      │   ├── __init__.pyc 
      │   ├── models.py 
      │   ├── models.pyc 
      │   ├── usagelib.py 
      │   └── views.py 
      ├── schedule 
      │   ├── admin.py 
      │   ├── __init__.py 
      │   ├── __init__.pyc 
      │   ├── models.py 
      │   ├── models.pyc 
      │   ├── tests.py 
      │   ├── usagelib.py 
      │   └── views.py 
      ├── src 
      │   ├── facebooksdk 
      │   │   ├── examples 
      │   │   │   ├── appengine 
      │   │   │   │   ├── app.yaml 
      │   │   │   │   ├── example.html 
      │   │   │   │   └── example.py 
      │   │   │   ├── newsfeed 
      │   │   │   │   ├── app.yaml 
      │   │   │   │   ├── facebookclient.py 
      │   │   │   │   ├── static 
      │   │   │   │   │   ├── base.css 
      │   │   │   │   │   ├── favicon.ico 
      │   │   │   │   │   └── robots.txt 
      │   │   │   │   └── templates 
      │   │   │   │    ├── base.html 
      │   │   │   │    ├── home.html 
      │   │   │   │    └── index.html 
      │   │   │   ├── oauth 
      │   │   │   │   ├── app.yaml 
      │   │   │   │   ├── facebookoauth.py 
      │   │   │   │   └── oauth.html 
      │   │   │   └── tornado 
      │   │   │    ├── example.html 
      │   │   │    ├── example.py 
      │   │   │    └── schema.sql 
      │   │   ├── facebook.py 
      │   │   ├── facebook_sdk.egg-info 
      │   │   │   ├── dependency_links.txt 
      │   │   │   ├── PKG-INFO 
      │   │   │   ├── SOURCES.txt 
      │   │   │   └── top_level.txt 
      │   │   ├── MANIFEST.in 
      │   │   ├── README.rst 
      │   │   └── setup.py 
      │   └── pip-delete-this-directory.txt 
      ├── static 
      │   └── js 
      │    └── jquery-1.10.1.min.js 
      ├── templates 
      │   ├── 404.html 
      │   ├── 500.html 
      │   ├── Base.html 
      │   ├── Home.html 
      │   ├── Reoccurring.html 
      │   └── Usersettings.html 
      └── usersetting 
       ├── admin.py 
       ├── __init__.py 
       ├── __init__.pyc 
       ├── models.py 
       ├── models.pyc 
       └── views.py 

我django.wsgi:

import os 
import sys 

sys.path.append('/srv/www/quickerhub.com/') 

os.environ['PYTHON_EGG_CACHE'] = '/srv/www/quickerhub.com.python-egg' 
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' 

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

我的httpd.conf:

我/ quickerhub.com啓用站點-:

WSGIPythonPath /srv/www/quickerhub.com 
<VirtualHost *:80> 
    ServerName quickerhub.com 

    Alias /static/ /srv/www/quickerhub.com/interest/static/ 
    WSGIScriptAlias//srv/www/quickerhub.com/interest/django.wsgi 

    <Directory /> 
     AllowOverride None 
     Options -Indexes 
    </Directory> 


</VirtualHost> 

我覺得一切都指向到正確的東西...

編輯:

現在剛開404文件未找到

請幫幫忙! 謝謝!

+0

這是什麼'VirtualHost'的東西在你的WSGI文件中做什麼?複製粘貼錯誤,還是真的存在? –

+0

對不起,是錯誤,更正了謝謝。 – ljrh

回答

1

我剛剛使用WSGI在Linode上設置了我的站點www.noobniche.com。不幸的是,我不在家比較我的設置,如果你今晚仍然有問題,我可以查看它。從我的情況來看,我必須通過添加啓用站點和站點的方式來啓用。

結構應該看起來類似於此;

webapps(root directory) 
    nichesite 
     static 
     django_project_name 
      --> myproject.wsgi 
      --> settings.py 
      --> urls.py 
      --> views.py 
     manage.py 

看起來您的.wsgi文件位於您的根目錄中,它應該位於您的django項目文件夾中。

+0

啊我會嘗試和更新在這裏,如果你可用,會對你的幫助很感興趣! – ljrh

+0

好的,我會稍後再回來查看。 –

+0

好的我接受了你的建議,並把django.wsgi移到了我的項目目錄中,現在我的'WSGIScriptAlias ///srv/www/quickerhub.com/interest/django.wsgi'與實際位置相匹配,但我仍然收到404在quickerhub.com錯誤。我已經更新了我的上面的目錄列表。我的錯誤日誌包含這一次嘗試後:'目標WSGI腳本未找到或不能stat:/ srv/www'我覺得這很奇怪,因爲WSGI別名不指向www ...我也覺得它可能是可能與權限有關?我做了loganhenson一個管理員,但不知道這是否足夠 – ljrh

0

因此,它看起來好像你有WSGIScriptAlias衝突的設置 - 一個在httpd.conf,指着你的WSGI文件正確的道路,一個在您的網站啓用文件,指向錯誤路徑(/var/而不是/srv/)。

您應該刪除httpd.conf中的一個,並將其移動到sites-enabled/quickerhub.com,以便該版本正確指向/srv/

+0

我改變了這一點,我仍然得到404 – ljrh

+0

你的Apache錯誤日誌裏有什麼? –

+0

[Wed Jul 03 12:51:10 2013] [notice] Apache/2.2.14(Ubuntu)mod_wsgi/2.8配置Python/2.6.5 - 恢復正常運行 [Wed Jul 03 12:51:18 2013]錯誤] [客戶端74.192.126.252]目標WSGI腳本未找到或無法統計:/ srv/www [Wed Jul 03 12:51:18 2013] [error] [client 74.192.126.252] Target WSGI script not found or unable to stat:/ srv/www [Wed Jul 03 12:52:18 2013] [error] [client 74.192.126。252]目標WSGI腳本未找到或無法統計:/ srv/www [Wed Jul 03 12:52:18 2013] [error] [client 74.192.126.252]目標WSGI腳本未找到或無法統計:/ srv/www – ljrh

相關問題