[英]i am trying to create a new project in django in python 3.4 and got the error below
Traceback (most recent call last):
File "C:\Users\SAGAR\Desktop\venv\lib\site-packages\django\core\management\__init__.py", line 179, in fetch_command
app_name = commands[subcommand]
KeyError: 'startprojecttest_project'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".\Scripts\django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "C:\Users\SAGAR\Desktop\venv\lib\site-packages\django\core\management\__init__.py", line 338, in execute_from_command_line
utility.execute()
File "C:\Users\SAGAR\Desktop\venv\lib\site-packages\django\core\management\__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\SAGAR\Desktop\venv\lib\site-packages\django\core\management\__init__.py", line 182, in fetch_command
settings.INSTALLED_APPS
File "C:\Users\SAGAR\Desktop\venv\lib\site-packages\django\conf\__init__.py", line 48, in __getattr__
self._setup(name)
File "C:\Users\SAGAR\Desktop\venv\lib\site-packages\django\conf\__init__.py", line 42, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: 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.
I am new at Django just now I installed Django and I am try to create a new_project using command ( (venv) C:\\Users\\SAGAR\\Desktop\\venv>python .\\Scripts\\django-admin.py startproject test_project
) but I got the error like that and I also set the environment variable like -- 我是Django的新手,我刚刚安装了Django,我尝试使用命令(
(venv) C:\\Users\\SAGAR\\Desktop\\venv>python .\\Scripts\\django-admin.py startproject test_project
) (venv) C:\\Users\\SAGAR\\Desktop\\venv>python .\\Scripts\\django-admin.py startproject test_project
但是我得到了这样的错误,我也将环境变量设置为-
C:\Python34;C:\Python34\Scripts;C:\Python34\python.exe;C:\Python34\Lib\site-packages\django\bin;
verify if you have added the path variable properly and try with the command 验证是否正确添加了path变量,然后尝试使用命令
django-admin startproject <project_name>
instead of 代替
django-admin.py startproject <project_name>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.