Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iam执行构建django2 web应用程序的代码。将sqlite db更改为postgresql后,我收到了此错误。如何消除此错误? “引擎”:“django.db.backends.postgredql”postgredql…?文件“H:\MyMDB\_Django_Python 3.x_Django Migrations_Django 2.0 - Fatal编程技术网

Iam执行构建django2 web应用程序的代码。将sqlite db更改为postgresql后,我收到了此错误。如何消除此错误? “引擎”:“django.db.backends.postgredql”postgredql…?文件“H:\MyMDB\

Iam执行构建django2 web应用程序的代码。将sqlite db更改为postgresql后,我收到了此错误。如何消除此错误? “引擎”:“django.db.backends.postgredql”postgredql…?文件“H:\MyMDB\,django,python-3.x,django-migrations,django-2.0,Django,Python 3.x,Django Migrations,Django 2.0,Iam执行构建django2 web应用程序的代码。将sqlite db更改为postgresql后,我收到了此错误。如何消除此错误? “引擎”:“django.db.backends.postgredql”postgredql…?文件“H:\MyMDB\django\config\settings.py”,第14行,从django.db.backends.postgresql\u psycopg2.base导入(ImportError:无法导入名称'BaseDatabaseValidation

Iam执行构建django2 web应用程序的代码。将sqlite db更改为postgresql后,我收到了此错误。如何消除此错误?
“引擎”:“django.db.backends.postgredql”
postgredql…?文件“H:\MyMDB\django\config\settings.py”,第14行,从django.db.backends.postgresql\u psycopg2.base导入(ImportError:无法导入名称'BaseDatabaseValidation'为什么要导入这些模块?您没有对它们做任何操作,这是正常的,因为这些是postgresql引擎的内部对象,需要从这些模块导入?django.db.utils.OperationalError:无法连接到服务器:连接被拒绝(0x0000274D/10061)服务器是否在主机“127.0.0.1”上运行并在端口5433上接受TCP/IP连接?现在是否收到此错误?
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\__init__.py", line 371, in 
execute_from_command_line
utility.execute()
File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\__init__.py", line 317, in execute
settings.INSTALLED_APPS
File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\django\conf\__init__.py", line 56, in __getattr__
self._setup(name)
File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\django\conf\__init__.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\django\conf\__init__.py", line 106, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "H:\MyMDB\django\config\settings.py", line 16, in <module>
from django.db.backends.postgresql_psycopg2.base import (
ImportError: cannot import name 'BaseDatabaseValidation'
"""
Django settings for config project.

Generated by 'django-admin startproject' using Django 2.0.3.

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

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

 import os
 from django.db.backends.postgresql_psycopg2.base import (
   DatabaseFeatures as BasePGDatabaseFeatures,
   DatabaseWrapper as BasePGDatabaseWrapper,
   DatabaseOperations as BasePGDatabaseOperations,
   DatabaseSchemaEditor as BasePGDatabaseSchemaEditor,
   DatabaseClient,
   DatabaseCreation as BasePGDatabaseCreation,
   DatabaseIntrospection,
   BaseDatabaseValidation,
 )

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


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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'p@t+^ek0_+zwu48)!ayar(sz*a#dh3vadg94vyj*zqcf&lji5&'

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

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
 'core',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
]

MIDDLEWARE = [
 'django.middleware.security.SecurityMiddleware',
 '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 = 'config.urls'

TEMPLATES = [
{
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [],
    'APP_DIRS': True,
    'OPTIONS': {
        'context_processors': [
            'django.template.context_processors.debug',
            'django.template.context_processors.request',
            'django.contrib.auth.context_processors.auth',
            'django.contrib.messages.context_processors.messages',
         ],
     },
 },
]

WSGI_APPLICATION = 'config.wsgi.application'


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

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgredql',
        'NAME': 'mymdb',
        'USER': 'mymdb',
        'PASSWORD': 'development',
        'HOST': '127.0.0.1',
        'PORT': '5432',
  }
}


# Password validation
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
    'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
    'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
    'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
    'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/2.0/topics/i18n/
LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


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