After updating to 1.2.3 and modifying the code to use django 1.0 (I
was using zipimport to use 1.0 before), I occassionally get this
exception. Once I get it, the only way to make it go away is to
restart the dev server. Could it be that making changes while dev
server is running is triggering some sort of reload that ignores the
use_library stuff?

gonzalo

On Jun 20, 6:48 am, CaiSong <xs23...@gmail.com> wrote:
> 1. App Engine version 1.2.3
> 2. you  Local install Django 1.0.2
> 3. add the following lines to the beginning of your script handler
> (main.py):
> from google.appengine.dist import use_library
> use_library('django', '1.0')
> 4. setting mush be comment following lines
> #    'django.contrib.sessions.middleware.SessionMiddleware',
> #    'django.contrib.auth.middleware.AuthenticationMiddleware',
>
> #    'django.contrib.auth',
> #    'django.contrib.sessions',
>
> settings.py e.g:
> _______________________________________________________________
> # Django settings for src project.
> import os
> DEBUG = True
> TEMPLATE_DEBUG = DEBUG
>
> BASE_PATH = os.path.dirname(__file__)
>
> ADMINS = (
>     # ('Your Name', 'your_em...@domain.com'),
> )
>
> MANAGERS = ADMINS
>
> DATABASE_ENGINE = ''           # 'postgresql_psycopg2', 'postgresql',
> 'mysql', 'sqlite3' or 'oracle'.
> DATABASE_NAME = ''             # Or path to database file if using
> sqlite3.
> DATABASE_USER = ''             # Not used with sqlite3.
> DATABASE_PASSWORD = ''         # Not used with sqlite3.
> DATABASE_HOST = ''             # Set to empty string for localhost.
> Not used with sqlite3.
> DATABASE_PORT = ''             # Set to empty string for default. Not
> used with sqlite3.
>
> # Local time zone for this installation. Choices can be found here:
> #http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
> # although not all choices may be available on all operating systems.
> # If running in a Windows environment this must be set to the same as
> your
> # system time zone.
> TIME_ZONE = 'America/Chicago'
>
> # Language code for this installation. All choices can be found here:
> #http://www.i18nguy.com/unicode/language-identifiers.html
> LANGUAGE_CODE = 'en-us'
>
> SITE_ID = 1
>
> # If you set this to False, Django will make some optimizations so as
> not
> # to load the internationalization machinery.
> USE_I18N = True
>
> # Absolute path to the directory that holds media.
> # Example: "/home/media/media.lawrence.com/"
> MEDIA_ROOT = ''
>
> # URL that handles the media served from MEDIA_ROOT. Make sure to use
> a
> # trailing slash if there is a path component (optional in other
> cases).
> # Examples: "http://media.lawrence.com";, "http://example.com/media/";
> MEDIA_URL = ''
>
> # URL prefix for admin media -- CSS, JavaScript and images. Make sure
> to use a
> # trailing slash.
> # Examples: "http://foo.com/media/";, "/media/".
> ADMIN_MEDIA_PREFIX = '/media/'
>
> # Make this unique, and don't share it with anybody.
> SECRET_KEY = 'p7x1he4xp117$h3r#l!*ra9wc5d=o(r...@p5x^14^6)mmj_t28w)'
>
> # List of callables that know how to import templates from various
> sources.
> TEMPLATE_LOADERS = (
>     'django.template.loaders.filesystem.load_template_source',
>     'django.template.loaders.app_directories.load_template_source',
> #     'django.template.loaders.eggs.load_template_source',
> )
>
> MIDDLEWARE_CLASSES = (
>     'django.middleware.common.CommonMiddleware',
> #    'django.contrib.sessions.middleware.SessionMiddleware',
> #    'django.contrib.auth.middleware.AuthenticationMiddleware',
> )
>
> ROOT_URLCONF = 'urls'
>
> TEMPLATE_DIRS = (
>     # Put strings here, like "/home/html/django_templates" or "C:/www/
> django/templates".
>     # Always use forward slashes, even on Windows.
>     # Don't forget to use absolute paths, not relative paths.
>     os.path.join(BASE_PATH,'templates'),
> )
>
> INSTALLED_APPS = (
> #    'django.contrib.auth',
>     'django.contrib.contenttypes',
> #    'django.contrib.sessions',
>     'django.contrib.sites',
> )
>
> _______________________________________________________________
> main.py e.g:
> _______________________________________________________________
> from google.appengine.dist import use_library
> use_library('django', '1.0')
> import logging, os
> # Google App Engine imports.
> from google.appengine.ext.webapp import util
>
> # Force Django to reload its settings.
> from django.conf import settings
> settings._target = None
>
> # Must set this env var *before* importing any part of Django
> os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
>
> import django.core.handlers.wsgi
> import django.core.signals
> import django.db
> import django.dispatch.dispatcher
>
> def log_exception(*args, **kwds):
>     logging.exception('Exception in request:')
>
>     # Log errors.
>     django.dispatch.dispatcher.connect(
>        log_exception, django.core.signals.got_request_exception)
>
>     # Unregister the rollback event handler.
>     django.dispatch.dispatcher.disconnect(
>         django.db._rollback_on_exception,
>         django.core.signals.got_request_exception)
>
> def main():
>     # Re-add Django 1.0 archive to the path, if needed.
> #    if django_path not in sys.path:
> #        sys.path.insert(0, django_path)
>
>     # Create a Django application for WSGI.
>     application = django.core.handlers.wsgi.WSGIHandler()
>
>     # Run the WSGI CGI handler with that application.
>     util.run_wsgi_app(application)
>
> if __name__ == '__main__':
>     main()
> _______________________________________________________________
>
> On Jun 20, 4:37 am, James <thelevybre...@gmail.com> wrote:
>
>
>
> > I added this code to my main.py file:
>
> > from google.appengine.dist import use_library
>
> > use_library('django', '1.0')
>
> > And this error is returned:
>
> > <class 'google.appengine.dist._library.UnacceptableVersionError'>:
> > django 1.0 was requested, but 0.96.1.None is already in use
> >       args = ('django 1.0 was requested, but 0.96.1.None is already in
> > use',)
> >       message = 'django 1.0 was requested, but 0.96.1.None is already
> > in use'
>
> > My local django installation is 1.02, but there may be some important
> > step I forgot. (And yes, tried restarting the dev server, etc.)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to