我正在使用我的服务器(Ubuntu)开发PokerAi, 我用过 https://github.com/datamllab/rlcard https://github.com/datamllab/rlcard-showdown/ 这些来源。 我尝试使用我的域而不是 localhost 运行 rlcard-showdown,但出现错误。 我的 django 版本是 4.2.3,node 版本是 20.4.0
这是我的错误。
Traceback (most recent call last):
File "/usr/lib/python3.8/wsgiref/handlers.py", line 137, in run
self.result = application(self.environ, self.start_response)
File "/usr/local/lib/python3.8/dist-packages/django/core/handlers/wsgi.py", line 124, in __call__
response = self.get_response(request)
File "/usr/local/lib/python3.8/dist-packages/django/core/handlers/base.py", line 139, in get_response
set_urlconf(settings.ROOT_URLCONF)
File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 104, in __getattr__
val = getattr(_wrapped, name)
File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 311, in __getattr__
return getattr(self.default_settings, name)
AttributeError: module 'django.conf.global_settings' has no attribute 'ROOT_URLCONF'
[06/Jul/2023 17:13:06] "GET / HTTP/1.1" 500 59
Traceback (most recent call last):
File "/usr/lib/python3.8/wsgiref/handlers.py", line 137, in run
self.result = application(self.environ, self.start_response)
File "/usr/local/lib/python3.8/dist-packages/django/core/handlers/wsgi.py", line 124, in __call__
response = self.get_response(request)
File "/usr/local/lib/python3.8/dist-packages/django/core/handlers/base.py", line 139, in get_response
set_urlconf(settings.ROOT_URLCONF)
File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 104, in __getattr__
val = getattr(_wrapped, name)
File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 311, in __getattr__
return getattr(self.default_settings, name)
AttributeError: module 'django.conf.global_settings' has no attribute 'ROOT_URLCONF'
[06/Jul/2023 17:13:06] "GET /favicon.ico HTTP/1.1" 500 59
和我的设置.py
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '-t@mf4fi)gfxzv5lm8qkg)*5u^brj--y*ul2&ryqdem(xin8(!'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = TRUE
ALLOWED_HOSTS = ['mydomain(i put this)', '000.000.00.00', '000.000.00.00']
# Cors config
CORS_ORIGIN_ALLOW_ALL=True
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'corsheaders',
'tournament',
]
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'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 = 'server.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 = 'server.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
}
# Password validation
# https://docs.djangoproject.com/en/2.2/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.2/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.2/howto/static-files/
STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
帮助........
模块“django.conf.global_settings”没有值 ROOT_URLCONF,因为您的 ROOT_URLCONF 配置不正确。
“server.urls”引用了不存在的内容。尝试“server.server.urls”,因为这就是您的项目的结构,或者将 urls.py 文件向上移动一级