複数のdjangoをインストールしたい。1 つは / (正常に動作しています) に、もう 1 つは /adam にあります。アプリにアクセスしようとするまで、スラッシュアダムのものはApacheによって正しくリダイレクトされます。たとえば、/admin は機能しますが、/adam/admin は機能しません。エラーが発生します:
Page not found (404)
Request Method: GET
Request URL: http://[CENSORED]/adam/
Using the URLconf defined in bms.urls, Django tried these URL patterns, in this order:
^admin/doc/
^admin/
The current URL, , didn't match any of these.
空のコンマに注意してください。Apache 仮想ホストは次のとおりです。
<VirtualHost *:80>
ServerName [CENSORED]
DocumentRoot /home/user/bms
Alias /static/admin/ /usr/local/lib/python2.7/site-packages/Django-1.3-py2.7.egg/django/contrib/admin/media/
<Directory /home/user/bms/apache>
Order allow,deny
Allow from all
</Directory>
<Directory /home/ajt1g09/bms/apache>
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess bms user=user group=user processes=2 threads=25 python-path=/usr/local/lib/python2.7/site-packages
WSGIProcessGroup bms
WSGIScriptAliasMatch ^/adam(.*) /home/ajt1g09/bms/apache/django.wsgi
WSGIScriptAlias / /home/user/bms/apache/django.wsgi
</VirtualHost>
ajt1g09/bms/apache の django.wsgi ファイル:
import os
import sys
path = '/home/ajt1g09/bms'
if path not in sys.path:
sys.path.append(path)
sys.path.append('/usr/local/lib/python2.7/site-packages')
sys.path.append('/home/ajt1g09')
os.environ['DJANGO_SETTINGS_MODULE'] = 'bms.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
そして最後に、ajt1g09/bms の urls.py ファイル (そこに /admin があることを明確に示しています):
django.conf.urls.defaults からインポート パターン、インクルード、URL
#次の 2 行のコメントを外して、admin を有効にします: from django.contrib import admin admin.autodiscover()
urlpatterns = patterns('', # 例: # url(r'^$', 'bms.views.home', name='home'), # url(r'^bms/', include('bms.foo .urls')),
# Uncomment the admin/doc line below to enable admin documentation: url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), )
何が問題なのかわかりません。