Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7565745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:14:01+00:00 2026-05-30T14:14:01+00:00

I have built a website based on Google App Engine. It includes ten models,

  • 0

I have built a website based on Google App Engine. It includes ten models, doing some simple calculations based on user inputs. Previously, it was coded using Python 2.5 using djangoform.modelform and db.model to handle data. Since Python 2.7 does not support djangoform.modelform, I would like to use django modelform instead. However, during the migration, I met some problems(sever internal error). when I was trying to add a form by Django.forms.Modelform. I have provided my old codes and new one (does not work). My questions are:

  1. How to use Django library to solve my problem?

  2. If it is possible, do I have to make my website a project, and create ten apps for models?

  3. Do I have to modify my yaml file, and create new url.py, setting.py, etc?

I really appreciate for any comment and suggestion. I am using Python 2.7, GAE 1.6.2 and Django 1.2.

Here is the code (code 1) with problem.

import webapp2 as webapp
import django
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp import template
import os
from django.db import models
from django.forms import ModelForm

class trexInp(models.Model):
    chemical_name = models.CharField(max_length=255)

class trexInput(ModelForm):
    class Meta:
        model = trexInp

class trexInputPage(webapp.RequestHandler):
    def get(self):        
        html = str(trexInput())
        self.response.out.write(html)

app = webapp.WSGIApplication([('/.*', trexInputPage)], debug=True)

def main():
    run_wsgi_app(app)

if __name__ == '__main__':
    main()

To compare, I have attached the old code (Code 2).

import webapp2 as webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
from google.appengine.ext.webapp import template
from google.appengine.ext.db import djangoforms

class trexInp(db.Model):
    chemical_name = db.StringProperty()

class trexInput(djangoforms.ModelForm):
    class Meta:
        model = trexInp

class trexInputPage(webapp.RequestHandler):
    def get(self):
        html = str(trexInput())
        self.response.out.write(html)

app = webapp.WSGIApplication([('/.*', trexInputPage)], debug=True)

def main():
    run_wsgi_app(app)

if __name__ == '__main__':
    main()

Here is my app.yaml file

application: pypest1
version: 1
runtime: python27
api_version: 1

threadsafe: false

libraries:
- name: numpy
  version: latest
- name: webapp2
  version: latest
- name: django
  version: "1.2"

handlers:
- url: /
  script: main.py 
- url: /index.html
  script: main.py 

#t-rex
- url: /trex_input.html
  script: trex/trex_input.py

My main.py file
import os
os.environ[‘DJANGO_SETTINGS_MODULE’]=’global_settings’
import webapp2 as webapp

from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp import template
from google.appengine.ext.db import djangoforms


class defaultPage(webapp.RequestHandler):
    def get(self):
        html = template.render('templates/01.html', {'title':'model'})
        self.response.out.write(html)
app = webapp.WSGIApplication([('/.*', defaultPage)], debug=True)

def main():
    run_wsgi_app(app)

if __name__ == '__main__':
    main()  

Here is the server log:

    2012-02-24 22:40:55 Running command: "['C:\\Python27\\pythonw.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--admin_console_server=', '--port=8082', u'C:\\Users\\tao\\Dropbox\\AppPest1']"
WARNING  2012-02-25 03:40:57,216 rdbms_mysqldb.py:74] The rdbms API is not available because the MySQLdb library could not be loaded.
INFO     2012-02-25 03:40:57,486 dev_appserver_multiprocess.py:650] Running application dev~pypest1 on port 8082: http://localhost:8082
INFO     2012-02-25 03:40:57,486 dev_appserver_multiprocess.py:652] Admin console is available at: http://localhost:8082/_ah/admin
WARNING  2012-02-25 03:40:59,211 py_zipimport.py:139] Can't open zipfile C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg-info: IOError: [Errno 13] file not accessible: 'C:\\Python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg-info'
INFO     2012-02-25 03:40:59,611 dev_appserver.py:2865] "GET / HTTP/1.1" 200 -
INFO     2012-02-25 03:40:59,671 dev_appserver.py:2865] "GET /stylesheets/style.css HTTP/1.1" 304 -
INFO     2012-02-25 03:40:59,720 dev_appserver.py:2865] "GET /images/valid-xhtml10-blue.png HTTP/1.1" 304 -
INFO     2012-02-25 03:40:59,767 dev_appserver.py:2865] "GET /images/valid-css-blue.png HTTP/1.1" 304 -
INFO     2012-02-25 03:40:59,816 dev_appserver.py:2865] "GET /stylesheets/images/bg.jpg HTTP/1.1" 304 -
INFO     2012-02-25 03:40:59,867 dev_appserver.py:2865] "GET /stylesheets/images/header.jpg HTTP/1.1" 304 -
INFO     2012-02-25 03:41:00,023 dev_appserver.py:2865] "GET /stylesheets/images/intro.jpg HTTP/1.1" 304 -
INFO     2012-02-25 03:41:00,381 dev_appserver.py:2865] "GET /favicon.ico HTTP/1.1" 404 -
INFO     2012-02-25 03:41:01,177 dev_appserver.py:2865] "GET /trex_description.html HTTP/1.1" 200 -
INFO     2012-02-25 03:41:01,538 dev_appserver.py:2865] "GET /stylesheets/style.css HTTP/1.1" 304 -
INFO     2012-02-25 03:41:01,585 dev_appserver.py:2865] "GET /images/valid-xhtml10-blue.png HTTP/1.1" 304 -
INFO     2012-02-25 03:41:01,632 dev_appserver.py:2865] "GET /images/valid-css-blue.png HTTP/1.1" 304 -
INFO     2012-02-25 03:41:01,783 dev_appserver.py:2865] "GET /stylesheets/images/bg.jpg HTTP/1.1" 304 -
INFO     2012-02-25 03:41:01,891 dev_appserver.py:2865] "GET /stylesheets/images/header.jpg HTTP/1.1" 304 -
INFO     2012-02-25 03:41:01,940 dev_appserver.py:2865] "GET /stylesheets/images/intro.jpg HTTP/1.1" 304 -
INFO     2012-02-25 03:41:01,996 dev_appserver.py:2865] "GET /favicon.ico HTTP/1.1" 404 -
WARNING  2012-02-25 03:41:03,632 py_zipimport.py:139] Can't open zipfile C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg-info: IOError: [Errno 13] file not accessible: 'C:\\Python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg-info'
ERROR    2012-02-25 03:41:03,657 cgi.py:121] Traceback (most recent call last):
  File "C:\Users\tao\Dropbox\AppPest1\trex\trex_input.py", line 33, in <module>
    class trexInp(models.Model):
  File "C:\Program Files (x86)\Google\google_appengine\lib\django_1_2\django\db\models\base.py", line 50, in __new__
    kwargs = {"app_label": model_module.__name__.split('.')[-2]}
IndexError: list index out of range

INFO     2012-02-25 03:41:03,686 dev_appserver.py:2865] "GET /trex_input.html HTTP/1.1" 500 -
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T14:14:02+00:00Added an answer on May 30, 2026 at 2:14 pm

    I can’t help you with your specific code, but I had to do a similar task (replace djangoforms) myself recently. This is the change that I cam up with. Hopefully you can learn something from it:

    http://code.google.com/p/rietveld/source/diff?spec=svn33bb90856ee02a26fa70c873658e91df445aca93&r=33bb90856ee02a26fa70c873658e91df445aca93&format=side&path=/codereview/views.py

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a dating website built on top of the Google App Engine,
I have a website built with ASP.NET (3.5) and want add some level of
I have built a website and when my users load up http://info.salemgolfclub.org/Account/Logon the username
I have built a website and now the customer wants to split it between
I have built a MVC website on IIS6. I used the built-in ASP.NET Security
I have a website built in PHP 4 with a framework made by hand
I have a website built using Asp.net and LinqToSql for Data Access. In a
I have a website built mostly in flash. The flash movie is on an
I'm fairly new to PHP and have built a medium sized website using standard
we have a modularized website built on the MVC pattern. We would like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.