gpt4 book ai didi

python manage.py makemigrations 给出 attributeError : module 'django.views.debug' has no attribute 'TECHNICAL_500_TEMPLATE' error

转载 作者:太空宇宙 更新时间:2023-11-03 14:22:18 25 4
gpt4 key购买 nike

我正在按照

中所述设置我的项目

this project from github

我采取的步骤..

通过此命令启动项目django-admin startproject theprojectname --extension py,yml,json --name Procfile,README.md,.env.example --template= https://github.com/vintasoftware/django-react-boilerplate/archive/boilerplate-release.zip

然后我安装了 pip 包

pip install -r 要求-to-freeze.txt拯救了他们

pip freeze > 要求.txt

运行 npm 更新命令

npm 更新--保存 npm update --save-dev

cp goDiary/settings/local.py.example goDiary/settings/local.pycp .env.example .env然后之后

python 管理.py makemigrations

我有几乎相同的代码,除了我重构了名称

创建 pip install -rrequirements.txt

我进行迁移时的输出是这样的

我的配置正确吗?

(myvenv2) shubhendu@shubhendu-HP-Pavilion-g6-Notebook-PC:/home/goDiary$ python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 27, in <module>
execute_from_command_line(sys.argv)
File "/home/goDiary/myvenv2/lib/python3.5/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/home/goDiary/myvenv2/lib/python3.5/site-packages/django/core/management/__init__.py", line 347, in execute
django.setup()
File "/home/goDiary/myvenv2/lib/python3.5/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/goDiary/myvenv2/lib/python3.5/site-packages/django/apps/registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "/home/goDiary/myvenv2/lib/python3.5/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/goDiary/myvenv2/lib/python3.5/site-packages/fixmydjango/__init__.py", line 22, in <module>
original_TECHNICAL_500_TEMPLATE = debug.TECHNICAL_500_TEMPLATE
AttributeError: module 'django.views.debug' has no attribute 'TECHNICAL_500_TEMPLATE'

这是我的

manage.py file

#!/usr/bin/env python

import os
import sys

from decouple import config


if __name__ == "__main__":
settings_module = config('DJANGO_SETTINGS_MODULE', default=None)

if sys.argv[1] == 'test':
if settings_module:
print("Ignoring config('DJANGO_SETTINGS_MODULE') because it's test. "
"Using 'goDiary.settings.test'")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "goDiary.settings.test")
else:
if settings_module is None:
print("Error: no DJANGO_SETTINGS_MODULE found. Will NOT start devserver. "
"Remember to create .env file at project root. "
"Check README for more info.")
sys.exit(1)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings_module)

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)

My wsgi.py

"""
WSGI config for goDiary project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

from whitenoise.django import DjangoWhiteNoise


os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.base")

application = get_wsgi_application()
application = DjangoWhiteNoise(application)

最佳答案

对于那些可能遇到同样问题的人,讨论正在该项目的 github 页面上进行,地址为 https://github.com/vintasoftware/django-react-boilerplate/issues/166

如果您只是想要答案,则可能与 Django 版本错误有关。检查您是否安装了 Django 1.11 而不是 Django 2.0 或其他版本:)

关于python manage.py makemigrations 给出 attributeError : module 'django.views.debug' has no attribute 'TECHNICAL_500_TEMPLATE' error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47859554/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com