0

Google 애플리케이션 엔진에 애플리케이션을 업로드 한 후 다음 오류가 발생합니다. 하지만 내 로컬 컴퓨터의 모든 것에는클라우드 SQL 연결 오류 (OperationalError)

OperationalError at /users/ 

(2004, "Can't create TCP/IP socket (-1)") 

Request Method:  GET 
Request URL: http://arctic-anvil-728.appspot.com/users/ 
Django Version:  1.4.13 
Exception Type:  OperationalError 
Exception Value:  

(2004, "Can't create TCP/IP socket (-1)") 

Exception Location:  /base/data/home/runtimes/python27/python27_lib/versions/third_party/MySQLdb-1.2.4b4/MySQLdb/connections.py in __init__, line 190 
Python Executable: /base/data/home/runtimes/python27/python27_dist/python 
Python Version:  2.7.5 
Python Path:  

['/base/data/home/apps/s~arctic-anvil-728/1.379355097665075133', 
'/base/data/home/runtimes/python27/python27_dist/lib/python27.zip', 
'/base/data/home/runtimes/python27/python27_dist/lib/python2.7', 
'/base/data/home/runtimes/python27/python27_dist/lib/python2.7/plat-linux2', 
'/base/data/home/runtimes/python27/python27_dist/lib/python2.7/lib-tk', 
'/base/data/home/runtimes/python27/python27_dist/lib/python2.7/lib-old', 
'/base/data/home/runtimes/python27/python27_dist/lib/python2.7/lib-dynload', 
'/base/data/home/runtimes/python27/python27_dist/lib/python2.7/site-packages', 
'/base/data/home/runtimes/python27/python27_lib/versions/1', 
'/base/data/home/runtimes/python27/python27_lib/versions/third_party/MySQLdb-1.2.4b4', 
'/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.4', 
'/base/data/home/runtimes/python27/python27_lib/versions/third_party/protorpc-1.0', 
'/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3', 
'/base/data/home/runtimes/python27/python27_lib/versions/third_party/webob-1.1.1', 
'/base/data/home/runtimes/python27/python27_lib/versions/third_party/yaml-3.10'] 

Server time: Mon, 13 Oct 2014 13:45:19 +0000 

날이 문제를 해결하기 위해 도와주세요 잘 작동한다.

답변

2

documentation에서 봐 주시기 바랍니다 사전에

감사합니다. App Engine에서 연결할 때 unix_socket을 사용해야합니다.

+0

내 settings.py를 공유했습니다. plz는 모양이 있습니다. – user562451

0
당신의 대답을 예를 내가 문서하지만 행운 :( 내가 구글 애플 리케이션 엔진 장고 나머지 프레임 워크를 사용하고 내 "settings.py"파일로 제발 좀 읽고 토니

감사 :

""" 

For more information on this file, see 
https://docs.djangoproject.com/en/1.6/topics/settings/ 

For the full list of settings and their values, see 
https://docs.djangoproject.com/en/1.6/ref/settings/ 
""" 

# Build paths inside the project like this: os.path.join(BASE_DIR, ...) 
import os 
BASE_DIR = os.path.dirname(os.path.dirname(__file__)) 


# Quick-start development settings - unsuitable for production 
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ 

# SECURITY WARNING: keep the secret key used in production secret! 
SECRET_KEY = '*****************************************' 

# SECURITY WARNING: don't run with debug turned on in production! 
DEBUG = True 

TEMPLATE_DEBUG = True 

ALLOWED_HOSTS = ['*'] 


# Application definition 

INSTALLED_APPS = (
    'django.contrib.admin', 
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', 
    'rest_framework', 
) 

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware', 
    'django.middleware.common.CommonMiddleware', 
    'django.middleware.csrf.CsrfViewMiddleware', 
    #'django.contrib.auth.middleware.AuthenticationMiddleware', 
    'django.contrib.messages.middleware.MessageMiddleware', 
    'django.middleware.clickjacking.XFrameOptionsMiddleware', 
) 

ROOT_URLCONF = 'my-rest.urls' 

WSGI_APPLICATION = 'my-rest.application' 


# Database 
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases 

DATABASES = { 
    'default': { 
     'ENGINE': 'django.db.backends.mysql', 
     'INSTANCE': 'appid:sql_instance_id', 
     'NAME': '********', 
     'USER': '********', 
     'HOST': '***.**.**.**', 
     'PASSWORD': '*********', 
    } 
} 

#DATABASES = { 
# 'default': { 
#  'ENGINE': 'django.db.backends.mysql', 
#  'NAME': 'app_engine', 
#  'USER': 'root', 
#  'HOST': 'localhost', 
#  'PASSWORD': '' 
# } 
#} 

# Internationalization 
# https://docs.djangoproject.com/en/1.6/topics/i18n/ 

LANGUAGE_CODE = 'en-us' 

TIME_ZONE = 'UTC' 

USE_I18N = True 

USE_L10N = True 

USE_TZ = True 

REST_FRAMEWORK = { 
    # Use Django's standard `django.contrib.auth` permissions, 
    # or allow read-only access for unauthenticated users. 
    'DEFAULT_PERMISSION_CLASSES': [ 
     'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly' 
    ] 
} 


# Static files (CSS, JavaScript, Images) 
# https://docs.djangoproject.com/en/1.6/howto/static-files/ 

STATIC_URL = '/static/' 

누군가가 내 샘플 코드를 원할 경우 이 코드의 잘못된 점을 알려주십시오.

+2

https : // docs에 따르면. djangoproject.com/en/dev/ref/settings/, django는 유닉스 소켓이라고 가정합니다. st 값은 슬래시로 시작합니다. 당신은 '/ cloudsql/'를 호스트 값으로 사용할 수 있습니까? –