实施 Django Grappelli 仪表板

发布于 2024-10-14 06:49:41 字数 926 浏览 4 评论 0原文

我很高兴第一次实现 Grappelli。我试图实现仪表板,但它似乎没有激活。问题是,我不确定它是什么样子。

Grappelli仪表板.py被应用(由createashboard生成)

settings.py(有趣的部分)

MEDIA_ROOT = 'I:/xampp/htdocs/project/media'
MEDIA_URL = 'http://cdn.pd/'
ADMIN_MEDIA_PREFIX = 'http://cdn.project/'
GRAPPELLI_ADMIN_HEADLINE = 'Admin Headline'
GRAPPELLI_INDEX_DASHBOARD = 'pd.dashboard.CustomIndexDashboard'
GRAPPELLI_ADMIN_URL = '/admin/'

TEMPLATE_DIRS = (
    'I:/xampp/htdocs/pd/src/templates'
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'grappelli.dashboard',
    'grappelli',
    'django.contrib.admin',
    'south',
)

有人有任何指示吗?这是我的项目的格式。除了基本的 django 启动之外,它是空的:

project  - pd
         |
         |- dashboard.py
         |- urls.py
         |- settings.py

任何指针都会很酷。

I've happily implemented Grappelli for the first time. I was trying to implement the dashboard but it doesn't seem to be activating. Trouble is, I'm not sure what it looks like.

The Grappelli dashboard.py is applied (generated by createdashboard)

settings.py (interesting parts)

MEDIA_ROOT = 'I:/xampp/htdocs/project/media'
MEDIA_URL = 'http://cdn.pd/'
ADMIN_MEDIA_PREFIX = 'http://cdn.project/'
GRAPPELLI_ADMIN_HEADLINE = 'Admin Headline'
GRAPPELLI_INDEX_DASHBOARD = 'pd.dashboard.CustomIndexDashboard'
GRAPPELLI_ADMIN_URL = '/admin/'

TEMPLATE_DIRS = (
    'I:/xampp/htdocs/pd/src/templates'
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'grappelli.dashboard',
    'grappelli',
    'django.contrib.admin',
    'south',
)

does anyone have any pointers? Heres a format of my project. Its empty aside from basic django initiation:

project  - pd
         |
         |- dashboard.py
         |- urls.py
         |- settings.py

Any pointers would be cool.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

君勿笑 2024-10-21 06:49:41

这对你来说可能有点晚了。您还需要将 django.core.context_processors.request 添加到 TEMPLATE_CONTEXT_PROCESSORS。

settings.py 将包括

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"

:)

This might be a little late for you. You need also need to add django.core.context_processors.request to TEMPLATE_CONTEXT_PROCESSORS.

settings.py will include:

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"

)

多彩岁月 2024-10-21 06:49:41

检查您的代码中是否没有自定义 templates/admin/index.html 。
我看到 Grapelli 和 grappelli.dashboard 使用不同的文件,
但只有当您使用第二个时,您的仪表板才可见。

Check if you not customized templates/admin/index.html in your code.
I see that grapelli and grappelli.dashboard use different files,
but only when you use second one, your dashboard be visible.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文