python manage.py makemigrations给出了attributeError:module'django.views.debug'没有属性'TECHNICAL_500_TEMPLATE'错误

时间:2017-12-17 21:19:14

标签: python node.js django

我按照

中的说法设置我的项目

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 requirements-to-freeze.txt 保存了他们

pip freeze> requirements.txt

执行npm update命令

npm update --save  npm update --save-dev

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

python manage.py makemigrations

除了重构名称

之外,我的代码几乎相同

making pip install -r requirements.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文件

#!/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)
  

我的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)

1 个答案:

答案 0 :(得分:1)

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

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