Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/22.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
德扬戈。在本地工作但不在pythonanywhere.com上工作的模板_Python_Django_Pythonanywhere - Fatal编程技术网

德扬戈。在本地工作但不在pythonanywhere.com上工作的模板

德扬戈。在本地工作但不在pythonanywhere.com上工作的模板,python,django,pythonanywhere,Python,Django,Pythonanywhere,当我在本地运行django时,我在django中有一个工作项目,但当我在pythonanywhere.com上运行它时,我就没有了。我得到了错误模板Doesnotexist 如何让它在pythonanywhere.com上运行 我是否必须在代码或Pythonywhere web应用程序设置中执行某些操作 谢谢 我的代码: 设置.py import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

当我在本地运行django时,我在django中有一个工作项目,但当我在pythonanywhere.com上运行它时,我就没有了。我得到了错误模板Doesnotexist

如何让它在pythonanywhere.com上运行

我是否必须在代码或Pythonywhere web应用程序设置中执行某些操作

谢谢

我的代码: 设置.py

import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

DEBUG = True

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['templates'],
        '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',
            ],
        },
    },
]



DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}



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',
    },
]



STATIC_URL = '/static/'
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'assets'),
)

您不应该在
模板
设置中使用相对目录
'templates'
。尝试将
DIRS
更改为:

    'DIRS': [os.path.join(BASE_DIR, 'templates')],