0

I'm running Django 1.7.1 on Jython 2.7b3 with django-jython 1.7.0, on Mac OSX, using the PostgreSQL backend (using Postgres.App to run the Postgres server).

I've created a prototype Django site, added a few simple models and registered them with the admin site. When I launch the development server, the "It works!" page loads normally. Accessing http://127.0.0.1:8000/admin/, the admin login functions normally and brings me to the main admin page, which lists all my models as expected.

However, when I click any link on that page (including the names of the models, add and change links, and even the change password/logout links), nothing happens - the browser just churns endlessly.

Based on the answer to this similar question, I tried using different browsers, but got the same result in Chrome, Firefox, and Safari.

This question seemed to have a similar issue, but the problem there was with the large amount of data, whereas my tables are totally empty. As far as I can tell (inspecting with pgAdmin), there's nothing out of the ordinary about the database, and manage.py migrate works normally. I tried creating a fresh new database just in case, but same result. However, I'm quite inexperienced with database admin, especially with PostgreSQL, so I might be missing something.

What else can I try? Or where can I look for more details about what could be going wrong?

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)),
)

Server log:

$ 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:

Screenshot of main Admin page

[EDIT] Per Spoutnik16's comment, I tried adding and reading objects in the shell. This seemed to work normally:

python shell output:

$ 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>]
Community
  • 1
  • 1
pilikia
  • 143
  • 10
  • did you try opening a django-admin shell and trying to get objects ? like `python manage.py shell` and then just trying to do some `Lesson.objects.all()` or `Test(name="hello world").save()` + `Test.objects.get(name="hello world")` ? if this fails, it means django can't access your database, and the bug is in the link between django and your database. If it works, I don't know. BTW, is your website in `DEBUG = True` mode ? – Spoutnik16 Jan 06 '15 at 12:58
  • @Spoutnik16 Good suggestion, I hadn't tried that. But unfortunately it didn't turn up anything: object saving/reading operations seem to work normally in the shell (I'll edit my question to add the shell output). And yes, `DEBUG` is set to `True`, but no debug messages are displayed - just no response whatsoever. – pilikia Jan 06 '15 at 13:23
  • and did you try to have a dummy entry for each models ? – Spoutnik16 Jan 06 '15 at 13:30
  • Yes, but same result. And anyway the admin site should function without any model objects, i.e. one should be able to use it to add the first objects, right? – pilikia Jan 06 '15 at 13:39
  • well, I don't know ^^ . I remember having problems with empty table once, but I really don't know. But at that point, I gave you everything I know, I can't help you :/ – Spoutnik16 Jan 06 '15 at 13:54
  • @Spoutnik16 Yeah this has me stumped, hopefully someone has other ideas. Thanks anyway! :) – pilikia Jan 06 '15 at 13:56

0 Answers0