管理站点在Django(在Jython上)开发服务器上挂起

时间:2015-01-06 12:16:14

标签: django postgresql django-admin jython

我在Mac OSX上使用django-jython 1.7.0在Jython 2.7b3上运行Django 1.7.1,使用PostgreSQL后端(使用Postgres.App运行Postgres服务器)。

我已经创建了一个Django原型网站,添加了一些简单的模型并在管理站点上注册了它们。当我启动开发服务器时,“它工作!”页面正常加载。访问http://127.0.0.1:8000/admin/,管理员登录功能正常,并将我带到主管理页面,该页面按预期列出了我的所有模型。

然而,当我点击该页面上的任何链接(包括模型的名称,添加和更改链接,甚至更改密码/注销链接)时,没有任何反应 - 浏览器只是无休止地搅拌。

根据this similar question的答案,我尝试使用不同的浏览器,但在Chrome,Firefox和Safari中获得了相同的结果。

This question似乎有一个类似的问题,但问题是大量的数据,而我的表是完全空的。据我所知(使用pgAdmin进行检查),数据库没有任何异常,manage.py migrate正常工作。我尝试创建一个全新的数据库,以防万一,但结果相同。但是,我对数据库管理员缺乏经验,尤其是PostgreSQL,所以我可能会遗漏一些东西。

我还能尝试什么?或者我在哪里可以查找可能出现问题的更多细节?

models.py

from django.db import models

# Create your models here.
class Exercise(models.Model):
    name = models.CharField(max_length=20)
    date_created = models.DateTimeField()
    def __unicode__(self):
        return self.name

class Widget(models.Model):
    name = models.CharField(max_length=20)

class Test(models.Model):
    name = models.CharField(max_length=20)

class Lesson(models.Model):
    name = models.CharField(max_length=20)
    description = models.TextField()

admin.py

from django.contrib import admin
from testapp.models import Lesson, Exercise, Widget, Test

# Register your models here.
admin.site.register(Lesson)
admin.site.register(Exercise)
admin.site.register(Widget)
admin.site.register(Test)

urls.py

from django.conf.urls import patterns, include, url
from django.contrib import admin

admin.autodiscover() #same results with and without this line

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'testproject.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    url(r'^admin/', include(admin.site.urls)),
)

服务器日志

$ jython manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
January 06, 2015 - 12:53:01
Django version 1.7.1, using settings 'testproject.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[06/Jan/2015 12:53:47] "GET / HTTP/1.1" 200 1759
[06/Jan/2015 12:53:49] "GET / HTTP/1.1" 200 1759
[06/Jan/2015 12:53:51] "GET /admin/ HTTP/1.1" 302 0
[06/Jan/2015 12:53:52] "GET /admin/login/?next=/admin/ HTTP/1.1" 200 1917
[06/Jan/2015 12:53:53] "GET /static/admin/css/base.css HTTP/1.1" 200 13995
[06/Jan/2015 12:53:53] "GET /static/admin/css/login.css HTTP/1.1" 200 940
[06/Jan/2015 12:53:54] "GET /static/admin/img/nav-bg.gif HTTP/1.1" 200 265
[06/Jan/2015 12:54:00] "POST /admin/login/?next=/admin/ HTTP/1.1" 302 0
[06/Jan/2015 12:54:00] "GET /admin/ HTTP/1.1" 200 4732
[06/Jan/2015 12:54:00] "GET /static/admin/css/dashboard.css HTTP/1.1" 200 434
[06/Jan/2015 12:54:00] "GET /static/admin/img/icon_changelink.gif HTTP/1.1" 200 119

截图

Screenshot of main Admin page

[编辑]根据Spoutnik16的评论,我尝试在shell中添加和读取对象。这似乎正常工作:

python shell输出

$ jython manage.py shell
Python 2.7b3 (default:e81256215fb0, Aug 4 2014, 02:39:51) 
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_51
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from testapp.models import Lesson, Test
>>> Lesson.objects.all()
[]
>>> Lesson(name="lesson1", description="some description text").save()
>>> Lesson.objects.all()
[<Lesson: Lesson object>]
>>> Test(name="testobject1").save()
>>> Test.objects.all()
[<Test: Test object>]

0 个答案:

没有答案