为什么django admin没有正确打开?

时间:2012-04-06 22:07:48

标签: python django

我正在使用django-userena,如果您使用pip安装它一切顺利,但如果您手动安装它然后键入python setup.py install,则管理区域不会像它应该{ {0}}


enter image description here

settings.py

    import os, sys

    abspath = lambda *p: os.path.abspath(os.path.join(*p))

    PROJECT_ROOT = abspath(os.path.dirname(__file__))
    USERENA_MODULE_PATH = abspath(PROJECT_ROOT, '..')
    sys.path.insert(0, USERENA_MODULE_PATH)

    DEBUG = True
    TEMPLATE_DEBUG = DEBUG

    ADMINS = (
        # ('Your Name', 'your_email@domain.com'),
    )

    MANAGERS = ADMINS

    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.sqlite3',
            'NAME': 'demo_project.db',
            'TEST_NAME': ':memory:',
        }
    }

    if DEBUG:
        # Use the Python SMTP debugging server. You can run it with:
        # ``python -m smtpd -n -c DebuggingServer localhost:1025``.
        EMAIL_PORT = 1025

    TIME_ZONE = 'America/Chicago'
    LANGUAGE_CODE = 'en-us'

    ugettext = lambda s: s
    LANGUAGES = (
        ('en', ugettext('English')),
        ('nl', ugettext('Dutch')),
        ('fr', ugettext('French')),
        ('pl', ugettext('Polish')),
        ('pt', ugettext('Portugese')),
        ('es', ugettext('Spanish')),
    )

    SITE_ID = 1

    USE_I18N = True
    USE_L10N = True

    MEDIA_ROOT = abspath(PROJECT_ROOT, 'media')
    DOCUMENT_ROOT = abspath(PROJECT_ROOT, 'docs')

    MEDIA_URL = '/media/'

    ADMIN_MEDIA_PREFIX = '/media/admin/'

    SECRET_KEY = 'sx405#tc)5m@s#^jh5l7$k#cl3ekg)jtbo2ds(n(kw@gp0t7x@'

    TEMPLATE_LOADERS = (
        'django.template.loaders.filesystem.Loader',
        'django.template.loaders.app_directories.Loader',
    )

    MIDDLEWARE_CLASSES = (
        'django.middleware.common.CommonMiddleware',
        'django.contrib.sessions.middleware.SessionMiddleware',
        'django.middleware.locale.LocaleMiddleware',
        'django.middleware.csrf.CsrfViewMiddleware',
        'django.contrib.auth.middleware.AuthenticationMiddleware',
        'django.contrib.messages.middleware.MessageMiddleware',
        'userena.middleware.UserenaLocaleMiddleware',
    )
    TEMPLATE_CONTEXT_PROCESSORS = (
        "django.contrib.auth.context_processors.auth",
        "django.core.context_processors.debug",
        "django.core.context_processors.i18n",
        "django.core.context_processors.media",
        "django.contrib.messages.context_processors.messages",
        "django.core.context_processors.request",
    )

    AUTHENTICATION_BACKENDS = (
        'userena.backends.UserenaAuthenticationBackend',
        'guardian.backends.ObjectPermissionBackend',
        'django.contrib.auth.backends.ModelBackend',
    )

    ROOT_URLCONF = 'demo_project.urls'

    TEMPLATE_DIRS = (
        abspath(PROJECT_ROOT, 'templates')
    )

    INSTALLED_APPS = (
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.sites',
        'django.contrib.messages',
        'django.contrib.admin',
        'easy_thumbnails',
        'guardian',
        'south',
        'userena',
        'userena.contrib.umessages',
        'demo_project.profiles',
    )

    # Userena settings
    LOGIN_REDIRECT_URL = '/accounts/%(username)s/'
    LOGIN_URL = '/accounts/signin/'
    LOGOUT_URL = '/accounts/signout/'
    AUTH_PROFILE_MODULE = 'profiles.Profile'

USERENA_DISABLE_PROFILE_LIST = True
USERENA_MUGSHOT_SIZE = 140

# Test settings
TEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner'
SOUTH_TESTS_MIGRATE = False

# Guardian
ANONYMOUS_USER_ID = -1

1 个答案:

答案 0 :(得分:0)

您需要使管理员静态文件可用。你的设置是什么?