Django 管理员:无法将应用程序添加到管理员

发布于 2024-08-15 05:04:04 字数 1097 浏览 4 评论 0原文

我已经在我的主机上安装了 Django(我使用他们的安装版本 1.1.1),一切正常。 我创建了一些应用程序,它们已在我的 settings.py 中注册(当我访问该网站时,我可以验证它是否有效,应用程序显示)。 在此应用程序的文件夹中,我创建了包含以下内容的 admin.py:

from progmaticnet.page.models import Page, PageContent
from django.contrib import admin

class PageContentInline( admin.StackedInline ):
  model = PageContent
  extra = 1
  max_num = 1

class PageAdmin( admin.ModelAdmin ):
  inlines = [ PageContentInline ]

  class Media:
    #js = ('/site_media/js/tinymce/jscripts/tiny_mce/tiny_mce.js', '/site_media/js/tinymce/textarea.js')


admin.site.register( Page, PageAdmin )

但我的应用程序没有显示在管理中...文档中说,您需要重新启动服务器,尽管我可以不这样做(在apache上运行),我有一个包含以下内容的dispatch.fcgi:

#!/usr/bin/python
import sys, os

project_sys="/home/progmati/public_html"

#add a custom python path
sys.path.insert(0, project_sys)

# set the DJANGO_SETTINGS_MODULE environment variable
os.environ['DJANGO_SETTINGS_MODULE'] = 'progmaticnet.settings'

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded")

我已经终止了该进程并重新启动它,但没有效果... 有人知道该怎么办吗?

谢谢

I have installed Django on my host (I use their install version 1.1.1), all is working fine.
I have created some apps and they are registered in my settings.py (I can verify this works when i visit the site, the app shows up).
In the folder of this app i have created admin.py with the following content:

from progmaticnet.page.models import Page, PageContent
from django.contrib import admin

class PageContentInline( admin.StackedInline ):
  model = PageContent
  extra = 1
  max_num = 1

class PageAdmin( admin.ModelAdmin ):
  inlines = [ PageContentInline ]

  class Media:
    #js = ('/site_media/js/tinymce/jscripts/tiny_mce/tiny_mce.js', '/site_media/js/tinymce/textarea.js')


admin.site.register( Page, PageAdmin )

But my app doesn't show up in the admin... It is said in the documentation that you'll need to restart the server, although i can't do that (runs on apache), i have a dispatch.fcgi with this content:

#!/usr/bin/python
import sys, os

project_sys="/home/progmati/public_html"

#add a custom python path
sys.path.insert(0, project_sys)

# set the DJANGO_SETTINGS_MODULE environment variable
os.environ['DJANGO_SETTINGS_MODULE'] = 'progmaticnet.settings'

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded")

I have killed the process and started it anew but with no avail...
Does anybody know what to do about it?

Thanks

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

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

发布评论

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

评论(1

三人与歌 2024-08-22 05:04:04

为什么 Media 类中的 js 声明被注释掉?结果看起来它将是一个无效的类定义(class 定义不能完全为空)。尝试取消注释,或在注释掉的行下方添加 pass,如下所示:

class Media:
  #js = ('/site_media/js/tinymce/jscripts/tiny_mce/tiny_mce.js', '/site_media/js/tinymce/textarea.js')
  pass

Why is the js declaration commented out in your Media class? That looks like it'll be an invalid class definition as a result (class definitions can't be entirely empty). Try uncommenting it, or adding pass below the commented out line, like this:

class Media:
  #js = ('/site_media/js/tinymce/jscripts/tiny_mce/tiny_mce.js', '/site_media/js/tinymce/textarea.js')
  pass
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文