1

私の質問は、Django管理サイトをApacheでrunserverと同じように(すべてきれいに)フォーマットするにはどうすればよいですか?起動してログインすることはできますが、すべてが適切にフォーマットされているわけではありません。

私のurls.pyファイルについて特別なことは何もありません

from django.conf.urls.defaults import *
from django.contrib import admin
from amr.views import hello

admin.autodiscover()

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
    ('^hello/$', hello),
    # Example:
    # (r'^amr/', include('amr.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    (r'^admin/', include(admin.site.urls)),
)

これが私のapache設定です。

<Location />
        SetHandler python-program
        PythonHandler django.core.handlers.modpython
        SetEnv DJANGO_SETTINGS_MODULE settings
        PythonOption django.root /home/amr/django/amr
        PythonPath "['/home/amr/django', '/home/amr/django/amr', '/usr/local/lib
/site-packages/django'] + sys.path"
        PythonDebug On
</Location>
4

1 に答える 1

1

ADMIN_MEDIAのCSS/JSが欠落している可能性があります。この設定はにありsettings.pyます。私は通常それを次のように設定します:

ADMIN_MEDIA_PREFIX = '/adminmedia/'

次に、Apache confに以下を追加します(実際のパスに合わせて変更します)。

Alias /adminmedia /usr/lib/python2.6/site-packages/django/contrib/admin/media/

これは、デフォルトのDjango管理メディアファイルを提供します。

次に、ここで説明するように、管理テンプレートをオーバーライドできます。

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates

于 2010-12-05T05:55:38.833 に答える