django non rel在GAE上创建超级用户

时间:2013-10-30 21:57:46

标签: python django google-app-engine django-nonrel

我真的是新的python开发,也是django。我想开发Web服务应用程序。我决定django non rel和GAE。我部署了django非rel测试应用程序。测试应用程序成功运行但我无法访问django管理页面。我研究过,发现这个“python manage.py remote createsuperuser”。但我不知道如何处理这个脚本以及在哪里运行

请帮助我

我做了“python manage.py syncdb”并给出了这条消息。我说是,但给出更多错误。

    WARNING  2013-10-31 17:00:33,191 dev_appserver.py:3565] The datastore file stub is deprecated, and
    will stop being the default in a future release.
    Append the --use_sqlite flag to use the new SQLite stub.

    You can port your existing data using the --port_sqlite_data flag or
    purge your previous test data with --clear_datastore.

    WARNING  2013-10-31 17:00:33,202 simple_search_stub.py:1009] Could not read search indexes from /var/folders/54/ndyvd2fx2c94frmdkn77l9f40000gn/T/dev_appserver.searchindexes
    WARNING  2013-10-31 17:00:33,204 dev_appserver.py:3673] Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging
    Creating tables ...

    You just installed Django's auth system, which means you don't have any superusers defined.
    Would you like to create one now? (yes/no):
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/Users/abdullahokudan/Documents/workspace/django-testapp22/django/core/management/__init__.py", line 459, in execute_manager
    utility.execute()
  File "/Users/abdullahokudan/Documents/workspace/django-testapp22/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/abdullahokudan/Documents/workspace/django-testapp22/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/abdullahokudan/Documents/workspace/django-testapp22/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/Users/abdullahokudan/Documents/workspace/django-testapp22/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/Users/abdullahokudan/Documents/workspace/django-testapp22/django/core/management/commands/syncdb.py", line 110, in handle_noargs
    emit_post_sync_signal(created_models, verbosity, interactive, db)
  File "/Users/abdullahokudan/Documents/workspace/django-testapp22/django/core/management/sql.py", line 189, in emit_post_sync_signal
    interactive=interactive, db=db)
  File "/Users/abdullahokudan/Documents/workspace/django-testapp22/django/dispatch/dispatcher.py", line 172, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/Users/abdullahokudan/Documents/workspace/django-testapp22/django/contrib/auth/management/__init__.py", line 74, in create_superuser
    call_command("createsuperuser", interactive=True, database=db)
  File "/Users/abdullahokudan/Documents/workspace/django-testapp22/django/core/management/__init__.py", line 150, in call_command
    return klass.execute(*args, **defaults)
  File "/Users/abdullahokudan/Documents/workspace/django-testapp22/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/Users/abdullahokudan/Documents/workspace/django-testapp22/django/contrib/auth/management/commands/createsuperuser.py", line 70, in handle
    default_username = get_default_username()
  File "/Users/abdullahokudan/Documents/workspace/django-testapp22/django/contrib/auth/management/__init__.py", line 106, in get_default_username
    default_username = get_system_username()
  File "/Users/abdullahokudan/Documents/workspace/django-testapp22/django/contrib/auth/management/__init__.py", line 86, in get_system_username
    return getpass.getuser().decode(locale.getdefaultlocale()[1])
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 511, in getdefaultlocale
    return _parse_localename(localename)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 443, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8

settings.py

    # Initialize App Engine and import the default settings (DB backend, etc.).
    # If you want to use a different backend you have to remove all occurences
    # of "djangoappengine" from this file.
    from djangoappengine.settings_base import *

    import os

    # Activate django-dbindexer for the default database
    DATABASES['native'] = DATABASES['default']
    DATABASES['default'] = {'ENGINE': 'dbindexer', 'TARGET': 'native'}
    AUTOLOAD_SITECONF = 'indexes'

    SECRET_KEY = '=r-$b*8hglm+858&9t043hlm6-&6-3d3vfc4((7yd0dbrakhvi'

    INSTALLED_APPS = (
        'django.contrib.admin',
        'django.contrib.contenttypes',
        'django.contrib.auth',
        'django.contrib.sessions',
        'djangotoolbox',
        'autoload',
        'dbindexer',

        # djangoappengine should come last, so it can override a few manage.py commands
        'djangoappengine',
    )

    MIDDLEWARE_CLASSES = (
        # This loads the index definitions, so it has to come first
        'autoload.middleware.AutoloadMiddleware',

        'django.middleware.common.CommonMiddleware',
        'django.contrib.sessions.middleware.SessionMiddleware',
        'django.contrib.auth.middleware.AuthenticationMiddleware',
    )

    TEMPLATE_CONTEXT_PROCESSORS = (
        'django.contrib.auth.context_processors.auth',
        'django.core.context_processors.request',
        'django.core.context_processors.media',
    )

    # This test runner captures stdout and associates tracebacks with their
    # corresponding output. Helps a lot with print-debugging.
    TEST_RUNNER = 'djangotoolbox.test.CapturingTestSuiteRunner'

    STATIC_URL = '/static/'

    TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), 'templates'),)

    ROOT_URLCONF = 'urls'

urls.py

    from django.conf.urls.defaults import *
    from django.contrib import admin
    import dbindexer

    handler500 = 'djangotoolbox.errorviews.server_error'

    # django admin
    admin.autodiscover()

    # search for dbindexes.py in all INSTALLED_APPS and load them
    dbindexer.autodiscover()

    urlpatterns = patterns('',
        ('^_ah/warmup$', 'djangoappengine.views.warmup'),
        ('^$', 'django.views.generic.simple.direct_to_template', {'template': 'home.html'}),
        ('^admin/', include(admin.site.urls)),
    )

0 个答案:

没有答案