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:
[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>]