Question

I have spent lots for time to resolve this issue but couldn't success. Still i am stuck here.

As i have deployed a django project on GAE(Google App Engine) using django-deployer and i am implementing django-social-auth in my django project. Here is the problem in detailed

localhost:8000 -

home/dev/djangoTaxi# python manage.py syncdb
Syncing...
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table south_migrationhistory
Creating table scheduler_client
Creating table scheduler_clientevaluation
Creating table scheduler_car
Creating table scheduler_taxi
Creating table scheduler_taxievaluation
Creating table scheduler_ride
Creating table scheduler_rideevaluation
Creating table registration_registrationprofile

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): yes
Username (leave blank to use 'root'): db_admin
Email address: myemail@gmail.com
Password: 
Password (again): 
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

Synced:
> django.contrib.auth
> django.contrib.contenttypes
> django.contrib.sessions
> django.contrib.sites
> django.contrib.messages
> django.contrib.staticfiles
> django.contrib.admin
> south
> scheduler
> registration

Not synced (use migrations):
- social_auth
(use ./manage.py migrate to migrate these)

When I run migrate command,I get this:

home/dev/djangoTaxi# python manage.py migrate
Running migrations for social_auth:
 - Migrating forwards to    0002_auto__add_unique_nonce_timestamp_salt_server_url__add_unique_associati.
 > social_auth:0001_initial
 >  social_auth:0002_auto__add_unique_nonce_timestamp_salt_server_url__add_unique_associati
  - Loading initial data for social_auth.
 Installed 0 object(s) from 0 fixture(s)

And here are database tables listed in mysql:

mysql> show tables;
+----------------------------------+
| Tables_in_db_taxi                |
+----------------------------------+
| auth_group                       |
| auth_group_permissions           |
| auth_permission                  |
| auth_user                        |
| auth_user_groups                 |
| auth_user_user_permissions       |
| django_admin_log                 |
| django_content_type              |
| django_session                   |
| django_site                      |
| registration_registrationprofile |
| scheduler_car                    |
| scheduler_client                 |
| scheduler_clientevaluation       |
| scheduler_ride                   |
| scheduler_rideevaluation         |
| scheduler_taxi                   |
| scheduler_taxievaluation         |
| social_auth_association          |
| social_auth_nonce                |
| social_auth_usersocialauth       |
| south_migrationhistory           |
+----------------------------------+
22 rows in set (0.00 sec)

As this migrate command creates required tables by social_auth. And it working fine on local server.

GAE: But these social auth tables not populating on Google Cloud SQL.Here is the detail. Google Cloud SQL (GAE) using django-deployer commands.

/djangoTaxi# sh manage.sh cloudsyncdb
Syncing...
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Instlled 0 object(s) from 0 fixture(s)

Synced:
 > django.contrib.auth
 > django.contrib.contenttypes
 > django.contrib.sessions
 > django.contrib.sites
 > django.contrib.messages
 > django.contrib.staticfiles
 > django.contrib.admin
 > south
 > scheduler
 > rocket_engine
 > registration

Not synced (use migrations):
 - social_auth
(use ./manage.py migrate to migrate these)

In order to solve this, I tried the following:

hom/dev/djangoTaxi# sh manage.sh migrate
Running migrations for social_auth:
- Nothing to migrate.
- Loading initial data for social_auth.
Installed 0 object(s) from 0 fixture(s)

and then it does not populate social_auth tables on GAE. Hence i am getting this error repeatedly.

DatabaseError at /complete/google-oauth2/
(1146L, u"Table 'db_DjangoTaxi.social_auth_usersocialauth' doesn't exist")

Can anyone help me to resolve this issue so that social_auth works fine on google app engine.

Thanks,

Was it helpful?

Solution 2

I got the origin of this problem and resolved it successfully.

Problem: is that we were unable to run migrate command on GAE,even we did this

hom/dev/djangoTaxi# sh manage.sh migrate

But this run locally and hence there is no effect on GAE.

Solution:

To overcome this issue just open the file manage.sh . It has some command implementation which run on GAE such as cloudcreatedb, cloudsyncdb and deploy . Hence there are no other command like migrate etc.. except the above three.

So i create a custom command in manage.sh named as cloudmigratedb by adding these lines after cloudsyncdb.

cloudmigratedb)
export SETTINGS_MODE=prod && manage_script migrate --all
;;

As it call *manage_script* method with args migrate --all Here is *manage_script* :

manage_script () {
env/bin/python $MANAGE_PY/manage.py $@ --settings=$DJANGO_SETTINGS_MODULE

}

This command is same as cloudsyncdb only differ in args. Hence we run the command as

hom/dev/djangoTaxi# sh manage.sh cloudmigratedb

And it finally run migrate on GAE. I got all tables on social_auth on GAE.

Happy Ending... :D

OTHER TIPS

Try this buddy :

manage.py schemamigration social_auth --auto

Then :

manage.py migrate social_auth

See the documentation (http://south.readthedocs.org/en/latest/tutorial/part1.html#tutorial-part-1) especially in "Changing The Model" section

Hopefully it works :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top