AttributeError: 'Settings' 对象没有属性 'ROOT_URLCONF' [英] AttributeError: 'Settings' object has no attribute 'ROOT_URLCONF'

查看:51
本文介绍了AttributeError: 'Settings' 对象没有属性 'ROOT_URLCONF'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

继我的最后一个问题 错误:没有名为 psycopg2.extensions 的模块,我已将我的 mac OS 更新为 Mountain Lion 并安装了 Xcode.我还使用sudo port install py27-psycopg2"安装了 psycopg2.我现在正在尝试运行python manage.py runserver",但收到此错误

Following on from my last question Error: No module named psycopg2.extensions, I have updated my mac OS to Mountain Lion and installed Xcode. I have also installed psycopg2 using 'sudo port install py27-psycopg2'. I am now trying to run 'python manage.py runserver' but am receiving this error

AttributeError: 'Settings' object has no attribute 'ROOT_URLCONF'

有关如何解决此问题并使我的本地主机运行的任何帮助?

Any help on how to fix this and get my localhost running?

推荐答案

来自 django 文档:

From django docs:

Django 设置文件包含 Django 安装的所有配置.当您使用 Django 时,您必须告诉它您正在使用哪些设置.通过使用环境变量 DJANGO_SETTINGS_MODULE 来执行此操作.

A Django settings file contains all the configuration of your Django installation. When you use Django, you have to tell it which settings you're using. Do this by using an environment variable, DJANGO_SETTINGS_MODULE.

DJANGO_SETTINGS_MODULE 的值应该是 Python 路径语法,例如mysite.settings.请注意,设置模块应位于Python 导入搜索路径.

The value of DJANGO_SETTINGS_MODULE should be in Python path syntax, e.g. mysite.settings. Note that the settings module should be on the Python import search path.

ROOT_URLCONF

默认:未定义

一个字符串,代表到你的根的完整 Python 导入路径网址配置.例如:mydjangoapps.urls".可以覆盖每个请求的基础上通过设置传入的属性 urlconfHttpRequest 对象.参见 Django 如何处理请求 了解详情.

A string representing the full Python import path to your root URLconf. For example: "mydjangoapps.urls". Can be overridden on a per-request basis by setting the attribute urlconf on the incoming HttpRequest object. See How Django processes a request for details.

这篇关于AttributeError: 'Settings' 对象没有属性 'ROOT_URLCONF'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆