2013-11-27 8 views
0

Dajaxice와 Dajax를 사용하는 Django 계정을 만들었습니다.Dajaxice는 로컬에서 실행되지만 장고 설정 문제는 온라인으로 작동합니다.

하늘빛 VM에서 내 웹 사이트를 실행합니다. 내가 localhost Dajaxice/Dajax와 함께 실행할 때 완벽하게 작동합니다.

그러나 온라인에서는 더 이상 작동하지 않습니다. 내 설정에 일부 구성 문제가 있지만이를 수정할 수 없습니다. 내 설정을 변경해야합니다, 그래서 액세스 할 수있는 방법을

GET http://localhost:1465/dajaxice/chocolate.chocolate.cellphone/?argv=%7B%22cell%22%3A%22jk%22%2C%22pID%22%3A%228353%22%7D 

을 :

<script src="/static/dajaxice/dajaxice.core.js" type="text/javascript" charset="utf-8"></script> 

Dajaxice/Dajax 기능은 다음과 같이 호출됩니다

로컬, Dajaxice/Dajax이 방법으로 지적되고있다 온라인 dajaxice?

이 지금까지 내 settings.py입니다 :

from os import path 
PROJECT_ROOT = path.dirname(path.abspath(path.dirname(__file__))) 

LOGIN_REDIRECT_URL = '' 

HTMLFILES_DIR = 'C:\inetpub\wwwroot\chocolate\chocolate\chocolate\htmlFiles' 

DEBUG = True 
TEMPLATE_DEBUG = DEBUG 

ADMINS = (
    ('x', '[email protected]'), 
) 

SESSION_EXPIRE_AT_BROWSER_CLOSE = True 

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.contrib.auth.context_processors.auth', 
    'django.core.context_processors.debug', 
    'django.core.context_processors.i18n', 
    'django.core.context_processors.media', 
    'django.core.context_processors.static', 
    'django.core.context_processors.request', 
    'django.contrib.messages.context_processors.messages', 
) 

MANAGERS = ADMINS 

DATABASES = { 
    'default': { 
     'NAME': 'xx', 
     'ENGINE': 'x', 
     'HOST': 'x.x.x', 
     'USER': '[email protected]', 
     'PASSWORD': 'x!', 
     'OPTIONS': { 
      'provider': 'x' 
     } 
    } 
} 

TIME_ZONE = 'Europe/London' 

LANGUAGE_CODE = 'en-us' 

SITE_ID = 1 

USE_I18N = True 

USE_L10N = True 

USE_TZ = True 

MEDIA_ROOT = HTMLFILES_DIR + '\Pictures' 

MEDIA_URL = 'http://localhost:1781/Pictures/' 

STATIC_ROOT = '' 

STATIC_URL = '/static/' 

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. 
) 

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder', 
    'django.contrib.staticfiles.finders.AppDirectoriesFinder', 
    'dajaxice.finders.DajaxiceFinder', 

) 

# Make this unique, and don't share it with anybody. 
SECRET_KEY = 'xxxxxxxxxxxxxxxxxx' 

# 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 = (
    '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', 
) 

ROOT_URLCONF = 'chocolate.urls' 

# Python dotted path to the WSGI application used by Django's runserver. 
WSGI_APPLICATION = 'chocolate.wsgi.application' 

TEMPLATE_DIRS = (

    HTMLFILES_DIR 
) 

INSTALLED_APPS = (
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.sites', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', 
    'chocolate.chocolate', 
    'dajaxice', 
    'dajax', 
    # Uncomment the next line to enable the admin: 
    'django.contrib.admin' 
    # Uncomment the next line to enable admin documentation: 
    # 'django.contrib.admindocs', 
) 
EMAIL_HOST = 'smtp-mail.outlook.com' 
EMAIL_HOST_USER = '[email protected]' 
EMAIL_HOST_PASSWORD = 'x' 
EMAIL_PORT = 587 
EMAIL_USE_TLS = True 

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' 
     }, 
     'console':{ 
      'level':'INFO', 
      'class':'logging.StreamHandler' 
     } 
    }, 
    'loggers': { 
     'django.request': { 
      'handlers': ['mail_admins'], 
      'level': 'ERROR', 
      'propagate': True, 
     }, 
     'dajaxice':{ 
      'handlers': ['console'], 
      'level': 'INFO', 
      'propagate': True, 
     }, 

    } 
} 

답변

0

글쎄, 난 그것을 수행하는 방법을 발견했다. 장고에 대한 경험이 거의없는 사람은이 정보가 도움이 될 수 있습니다.

나는 다음과 같은 정보를 가지고, localhost를 사용

은 괜찮 :

STATIC_ROOT = '' 

STATIC_URL = '/static/' 

그러나, 당신이 당신의 응용 프로그램을 배포 할 계획하면, 응용 프로그램에서 어딘가에 파일을 작성해야하고 STATIC_ROOT의 경로를 포함 .

STATIC_ROOT = 'C:/inetpub/wwwroot/chocolate/chocolate/chocolate/static/' 

나는 수동으로 위에서 볼 수 정적라는 파일을 생성 : 내 경우에는, 다음이었다. 그런 다음 STATIC_URL에 생성 된 파일의 이름을 추가하십시오.

STATIC_URL = '/static/' 

그런 다음 콘솔에서 앱의 manage.py가있는 파일에 액세스하십시오. python을 명령으로 추가하고 python manage.py collectstatic을 작성하십시오. 모든 정적 파일은 사용자가 생성 한 정적 파일에 있습니다. 필자의 경우, python manage.py collectstatic을 쓰고 나면 dajaxice와 dajax의 파일이이 폴더에 나타납니다.

이제 dajaxice/dajax는 배포 후에 온라인으로 작동합니다.