Unable to login to django admin view with valid username and password
Question: I know this question has been asked several times before but most of the
question were asked long ago and old answers did not work for me.

I have a django-nonrel based app which is using dbindexer as backend and
deployed on GAE. I am able to view homepage of my app which does not require
login.  
But when I try to login to admin view, it gives "wrong username / password"

On my local development server, if I use "manage.py runserver", then I am able
to login on admin page. But If I run my app through GAE launcher, then I am
not able to login.

I could gather that GAE launcher uses different django from "manage.py
runserver". So, how can I make GAE (on launcher as well as on deployment
server) use django-nonrel?

Other details:

    
    
    app.yaml does NOT include "django" library.
    
    settings.py  
    
    DATABASES['native'] = DATABASES['default']
    DATABASES['default'] = {'ENGINE': 'dbindexer', 'TARGET': 'native'}  
    
    MIDDLEWARE_CLASSES = (
        'django.middleware.common.CommonMiddleware',
        'django.contrib.sessions.middleware.SessionMiddleware',
        'django.middleware.csrf.CsrfViewMiddleware',
        'django.contrib.auth.middleware.AuthenticationMiddleware',
        'django.contrib.messages.middleware.MessageMiddleware',
        # Uncomment the next line for simple clickjacking protection:
        # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
    )
    
    INSTALLED_APPS = (
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.messages',
        'django.contrib.staticfiles',
    
        'djangotoolbox',
        'autoload',
        'dbindexer',
    
        # Uncomment the next line to enable the admin:
        'django.contrib.admin',
        # Uncomment the next line to enable admin documentation:
        'django.contrib.admindocs',
    
        'djangoappengine',
        'testapp',
    )  
    
    urls.py
    
    from django.conf.urls.defaults import *
    from django.contrib import admin
    admin.autodiscover()
    
    urlpatterns = patterns('',
        url(r'^admin/', include(admin.site.urls)),    
    )
    

**UPDATE 1::**  
As @dragonx pointed out, I need to run `python manage.py remote
createsuperuser` and create the user.

On local server, when I run 'manage.py syncdb', it fills database with
initializing data which also includes creating a superuser. I use
'initial_data.yaml' inside 'fixtures' directory for this and is read
automatically by syncdb command.  
So, Is there any way to run "syncdb' on server side? Somehow I assumed this is
happening automatically at deployment just like 'manage.py runserver' happens
itself and I do not need to run app manually.

If I run `manage.py remote syncdb`, it blurts out following error:

    
    
    google.appengine.api.datastore_errors.NeedIndexError: no matching index found.
    <<ed>>some stack trace<<ed>>
    The suggested index for this query is:
    - kind: django_content_type
      properties:
      - name: app_label
      - name: name
    

**Update 2:**  
Instead of using `appcfg.py update site` command, if you use `python manage.py
deploy` from your app directory, it runs fixtures on remote server. Don't know
what's doing what.  
`manage.py remote loaddata initdata.yaml` can also be used to initialize
remote database.

But even after this, I still do not see the fixtures data loaded in admin
interface i.e. it seems database was not initialized or maybe admin view is
badly broken. But I'd save that for another question~


Answer: When you run `python manage.py runserver` it starts a local dev server on your
local machine. It has it's own dev datastore on your local machine. At some
point you created an admin user in your local database.

When you deploy on app engine, it runs your code on Google's servers. There's
a datastore there, but it doesn't share the data on your dev server. You'll
need to create an admin user in the production datastore too. Try:

`python manage.py remote createsuperuser`

