1

I was trying to implement the poll app tutorial of Django using djangoappengine.

Steps I took:
1)Copied the test-app in workspace folder.

2)Copied django-toolbox, dbindexer, django, djangoappengine, autoload, as directed on website http://www.allbuttonspressed.com/projects/djangoappengine, in 'test-app' folder.

3) Started a new project in eclipse as PyDev Google App Engine Project and made test-app as the working folder.

4) Now I deployed the app on GAE using terminal

$ python manage.py deploy

Got the "It Works" page on x.appspot.com.

5) Now I tried to make a polls app as directed in the tutorial

python manage.py startapp polls

folder 'polls' was created with four files

6) I edited the polls' model.py file and added the code as mentioned in tutorial-1 Then I ran the command-

$ python manage.py syncdb

It showed no error but did not create a new table of polls. I had added 'polls' under 'Installed_Apps' in settings.py
I think the problem is in Database declartion where it is dbindexer instead of django.db.backends.sqlite3, but i am not sure.

Also there is error when i run this in shell

>>> from django.utils import timezone
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: cannot import name timezone 

I have some more queries but I will mention it after the above has been solved.

DrKaoliN
  • 1,346
  • 4
  • 25
  • 39
Ashish
  • 131
  • 9
  • I have got the reason for timezone problem (timezone requires django > 1.3.1). Please solve the syncdb problem – Ashish Sep 18 '12 at 11:10
  • Ok I got it. It had created the table, but as it was not showing in admin, I had the problem. Then I realized I hadn't registered the polls in admins.py. – Ashish Sep 19 '12 at 07:43

2 Answers2

0

The Django tutorial is written for the latest version of django. As far as I recall, timezone was added to django.utils around 1.3? Can you check what version of Django you have? The current version is 1.41.

Owen
  • 174
  • 1
  • 1
  • 9
  • Can you try (to check django is being picked up by python): import django (enter) print django.get_version() (enter) – Owen Sep 18 '12 at 09:50
  • It shows 1.3.1, but I had installed Django 1.4.1 I guess it is because GAE SDK has Django 1.3 bundled with it. – Ashish Sep 18 '12 at 10:23
0

According to this page for App Engine 3rd Party support in Python 2.7

https://developers.google.com/appengine/docs/python/tools/libraries27

App engine only supports these versions:

"1.2"

"1.3"

"latest"

So I don't think you can use 1.41.

There are further notes on Django usage here:

https://developers.google.com/appengine/docs/python/tools/libraries27#django

To use Django with the NDB storage API, add 'google.appengine.ext.ndb.django_middleware.NdbDjangoMiddleware', to the MIDDLEWARE_CLASSES entry in your Django settings.py file.

Do you have an entry in your app.yaml like this?

libraries:
- name: django
  version: "1.3"

Have you done this?

To use Django with the NDB storage API, add 'google.appengine.ext.ndb.django_middleware.NdbDjangoMiddleware', to the MIDDLEWARE_CLASSES entry in your Django settings.py

Paul Collingwood
  • 9,053
  • 3
  • 23
  • 36