2015-07-17 1 views
1

Je suis incapable d'enregistrer quoi que ce soit dans mon projet de développement django non-rel .. J'ai google app engine sdk installé avec django non-rel. Je peux accéder à la page d'administration de django, mais je ne peux pas me connecter car aucun super-utilisateur n'est sauvegardé. J'ai essayé de créer un utilisateur dans le shell manage.py. Mais après la fermeture de la fenêtre shell, l'objet utilisateur que j'avais précédemment enregistré n'était pas présent. S'il vous plaît aidez-moi comment enregistrer des données à base de données dans django-non-rel ..Rien ne est stocké dans django non-rel pour google app engine

Mon fichier settings.py est -

# Django settings for bookncart project. 

# 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 * 

ADMINS = (
    # ('Your Name', '[email protected]'), 
) 

MANAGERS = ADMINS 

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

AUTOLOAD_SITECONF = 'indexes' 

# Hosts/domain names that are valid for this site; required if DEBUG is False 
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts 
ALLOWED_HOSTS = [] 

# 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. 
# In a Windows environment this must be set to 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 

# If you set this to False, Django will not format dates, numbers and 
# calendars according to the current locale. 
USE_L10N = True 

# If you set this to False, Django will not use timezone-aware datetimes. 
USE_TZ = False 

# Absolute filesystem path to the directory that will hold user-uploaded files. 
# Example: "/var/www/example.com/media/" 
MEDIA_ROOT = '' 

# URL that handles the media served from MEDIA_ROOT. Make sure to use a 
# trailing slash. 
# Examples: "http://example.com/media/", "http://media.example.com/" 
MEDIA_URL = '' 

# Absolute path to the directory static files should be collected to. 
# Don't put anything in this directory yourself; store your static files 
# in apps' "static/" subdirectories and in STATICFILES_DIRS. 
# Example: "/var/www/example.com/static/" 
STATIC_ROOT = '' 

# URL prefix for static files. 
# Example: "http://example.com/static/", "http://static.example.com/" 
STATIC_URL = '/static/' 

# Additional locations of static files 
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static". 
    # Always use forward slashes, even on Windows. 
    # Don't forget to use absolute paths, not relative paths. 
) 

# List of finder classes that know how to find static files in 
# various locations. 
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder', 
    'django.contrib.staticfiles.finders.AppDirectoriesFinder', 
# 'django.contrib.staticfiles.finders.DefaultStorageFinder', 
) 

# Make this unique, and don't share it with anybody. 
SECRET_KEY = '[email protected]_*#3r04f1r09jf=&emqddc4a0!=yrvz(tbr23' 

# List of callables that know how to import templates from various sources. 
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader', 
    'django.template.loaders.app_directories.Loader', 
#  'django.template.loaders.eggs.Loader', 
) 

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.middleware.csrf.CsrfViewMiddleware', 
    'django.contrib.auth.middleware.AuthenticationMiddleware', 
    # 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 
    'django.contrib.messages.middleware.MessageMiddleware', 
    'django.middleware.clickjacking.XFrameOptionsMiddleware', 
    # 'django.middleware.security.SecurityMiddleware', 
    # Uncomment the next line for simple clickjacking protection: 
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware', 
) 

ROOT_URLCONF = 'bookncart.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. 
) 

INSTALLED_APPS = (
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    # 'django.contrib.sites', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', 
    # Uncomment the next line to enable the admin: 
    'django.contrib.admin', 
    # Uncomment the next line to enable admin documentation: 
    'django.contrib.admindocs', 
    'django.contrib.staticfiles', 
    'djangotoolbox', 
    'autoload', 
    'dbindexer', 

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

# A sample logging configuration. The only tangible logging 
# performed by this configuration is to send an email to 
# the site admins on every HTTP 500 error when DEBUG=False. 
# See http://docs.djangoproject.com/en/dev/topics/logging for 
# more details on how to customize your logging configuration. 
LOGGING = { 
    'version': 1, 
    'disable_existing_loggers': False, 
    'filters': { 
     'require_debug_false': { 
      '()': 'django.utils.log.RequireDebugFalse' 
     } 
    }, 
    'handlers': { 
     'mail_admins': { 
      'level': 'ERROR', 
      'filters': ['require_debug_false'], 
      'class': 'django.utils.log.AdminEmailHandler' 
     } 
    }, 
    'loggers': { 
     'django.request': { 
      'handlers': ['mail_admins'], 
      'level': 'ERROR', 
      'propagate': True, 
     }, 
    } 
} 

et le fichier est urls.py -

from django.conf.urls import patterns, include, url 

# Uncomment the next two lines to enable the admin: 
from django.contrib import admin 
admin.autodiscover() 

urlpatterns = patterns('', 
    # Examples: 
    # url(r'^$', 'bookncart.views.home', name='home'), 
    # url(r'^bookncart/', include('bookncart.foo.urls')), 

    # Uncomment the admin/doc line below to enable admin documentation: 
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')), 

    # Uncomment the next line to enable the admin: 
    url(r'^admin/', include(admin.site.urls)), 
) 

les paramètres de base pour djangoappengine sont ces -

try: 
    from dev_appserver_version import DEV_APPSERVER_VERSION 
except ImportError: 
    DEV_APPSERVER_VERSION = 2 

# Initialize App Engine SDK if necessary. 
try: 
    from google.appengine.api import apiproxy_stub_map 
except ImportError: 
    from djangoappengine.boot import setup_env 
    setup_env(DEV_APPSERVER_VERSION) 

from djangoappengine.utils import on_production_server, have_appserver 


DEBUG = not on_production_server 
TEMPLATE_DEBUG = DEBUG 

ROOT_URLCONF = 'urls' 

DATABASES = { 
    'default': { 
     'ENGINE': 'djangoappengine.db', 

     # Other settings which you might want to override in your 
     # settings.py. 

     # Activates high-replication support for remote_api. 
     # 'HIGH_REPLICATION': True, 

     # Switch to the App Engine for Business domain. 
     # 'DOMAIN': 'googleplex.com', 

     # Store db.Keys as values of ForeignKey or other related 
     # fields. Warning: dump your data before, and reload it after 
     # changing! Defaults to False if not set. 
     # 'STORE_RELATIONS_AS_DB_KEYS': True, 

     'DEV_APPSERVER_OPTIONS': { 
      'use_sqlite': True, 

      # Optional parameters for development environment. 

      # Emulate the high-replication datastore locally. 
      # TODO: Likely to break loaddata (some records missing). 
      # 'high_replication' : True, 

      # Setting to True will trigger exceptions if a needed index is missing 
      # Setting to False will auto-generated index.yaml file 
      # 'require_indexes': True, 
     }, 
    }, 
} 

if on_production_server: 
    EMAIL_BACKEND = 'djangoappengine.mail.AsyncEmailBackend' 
else: 
    EMAIL_BACKEND = 'djangoappengine.mail.EmailBackend' 

# Specify a queue name for the async. email backend. 
EMAIL_QUEUE_NAME = 'default' 

PREPARE_UPLOAD_BACKEND = 'djangoappengine.storage.prepare_upload' 
SERVE_FILE_BACKEND = 'djangoappengine.storage.serve_file' 
DEFAULT_FILE_STORAGE = 'djangoappengine.storage.BlobstoreStorage' 
FILE_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024 
FILE_UPLOAD_HANDLERS = (
    'djangoappengine.storage.BlobstoreFileUploadHandler', 
    'django.core.files.uploadhandler.MemoryFileUploadHandler', 
) 

CACHES = { 
    'default': { 
     'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 
     'TIMEOUT': 0, 
    } 
} 

SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db' 

if not on_production_server: 
    INTERNAL_IPS = ('127.0.0.1',) 

s'il vous plaît aidez-moi comment obtenir la base de données Setti NGS travail .. je suis incapable de trouver une solution de 2 jours

+0

Face à même question, avez-vous trouvé une solution? –

+0

aucun didnt trouvé aucune solution..switched à l'aide de django avec sql et mis au rebut google app engine work. – ashish

+0

Face à la même chose. @GeoJacob une mise à jour à ce sujet? – sreekanth

Répondre

0

Vous pouvez modifier votre

ALLOWED_HOSTS = ['<Name of Application in YAML>.appspot.com'] 

Pour plus de détails sur ALLOWED_HOSTS