Python [解决方法] error: Requested setting INSTALLED_APPS, but settings are not configured

来源:互联网 发布:淘宝旧版本5.1.0下载 编辑:程序博客网 时间:2024/06/08 02:16

今天在学习Django库

在创建项目的时候:

django-admin.py startproject [项目名称]

报错

error: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.).

解决

经过各种折腾,最后找到解决方法

django-admin startproject [项目名称]

对,就是这么简单,把django-admin.py换成django-admin

分析

为什么这样:
我是用pip装的Django,而网上大部分的安装指南是手动安装的。
pip在安装Django的时候会自动生成一个django-admin的可运行文件。所以~

0 0