我花了很多時間來解決此問題,但無法成功。我仍然陷在這裏。無法在Google應用引擎(GAE)上爲django-social-auth創建表
因爲我在GAE(Google App Engine)上部署了一個django項目,使用django-deployer,我在我的django項目中實現了django-social-auth。下面是詳細
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: [email protected]
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)
當我運行migrate
命令,我得到這個:
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)
,這裏是數據庫表在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)
由於此遷移com mand由social_auth創建必需的表。它在本地服務器上正常工作。
GAE: 但是這些社交授權表沒有填充到Google雲端SQL.Here是細節。 Google Cloud SQL(GAE)使用django-deployer命令。
/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)
爲了解決這個問題,我試過如下:
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)
,然後不填充在GAE social_auth表。因此我反覆得到這個錯誤。
DatabaseError at /complete/google-oauth2/
(1146L, u"Table 'db_DjangoTaxi.social_auth_usersocialauth' doesn't exist")
任何人都可以幫助我解決這個問題,以便social_auth在Google應用引擎上正常工作。
謝謝,
嗯,這也可能工作,因爲我們需要在GAE上執行此操作,因此需要將其添加到manage.sh腳本中,如我在回答中所述。所以遷移 - 也爲我工作。謝謝您的幫助。 – CrazyGeek
我看到,遷移 - 所有也解決了問題..好吧:) –
要使用django-social-auth,我們需要south和migrate命令。 –