2017-10-11 51 views
0

我是python新手。我给了以下命令:python manage.py运行服务器抛出错误

django-admin startproject webserver 

这创建了一个框架项目。在此之后,我跑

python manage.py runserver 0.0.0.0:8001 

我得到下面给出的错误。我无法启动服务器。请引导我?

C:\training\webserver\webserver>python manage.py runserver 0.0.0.0:8001 
Unhandled exception in thread started by <function wrapper at 0x0000000003C872E8> 
Traceback (most recent call last): 
    File "C:\Python27\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper 
    fn(*args, **kwargs) 
    File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run 
    autoreload.raise_last_exception() 
    File "C:\Python27\lib\site-packages\django\utils\autoreload.py", line 251, in raise_last_exception 
    six.reraise(*_exception) 
    File "C:\Python27\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper 
    fn(*args, **kwargs) 
    File "C:\Python27\lib\site-packages\django\__init__.py", line 27, in setup 
    apps.populate(settings.INSTALLED_APPS) 
    File "C:\Python27\lib\site-packages\django\apps\registry.py", line 108, in populate 
    app_config.import_models() 
    File "C:\Python27\lib\site-packages\django\apps\config.py", line 202, in import_models 
    self.models_module = import_module(models_module_name) 
    File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module 
    __import__(name) 
    File "C:\Python27\lib\site-packages\django\contrib\auth\models.py", line 299, in <module> 
    class AbstractUser(AbstractBaseUser, PermissionsMixin): 
    File "C:\Python27\lib\site-packages\django\db\models\base.py", line 279, in __new__ 
    new_class.add_to_class(field.name, new_field) 
    File "C:\Python27\lib\site-packages\django\db\models\base.py", line 325, in add_to_class 
    value.contribute_to_class(cls, name) 
    File "C:\Python27\lib\site-packages\django\db\models\fields\__init__.py", line 709, in contribute_to_class 
    cls._meta.add_field(self) 
    File "C:\Python27\lib\site-packages\django\db\models\options.py", line 277, in add_field 
    self.local_fields.insert(bisect(self.local_fields, field), field) 
    File "C:\Python27\lib\functools.py", line 56, in <lambda> 
    '__lt__': [('__gt__', lambda self, other: other < self), 
    File "C:\Python27\lib\functools.py", line 56, in <lambda> 
    '__lt__': [('__gt__', lambda self, other: other < self), 
+0

您正在使用什么版本的Django的? –

+0

按照教程,你错过了一些步骤 – newlife

+2

请发布整个堆栈跟踪;你错过了它的结局。 –

回答

0

您可能会错过正确创建过程中的一些步骤。

  1. 的mkdir测试
  2. CD测试/
  3. 的virtualenv测试(我将创建一个Python 2.7 ENV)
  4. 源测试/斌/启动: 我只是用这个步骤测试它在我的机器上
  5. PIP安装Django
  6. Django的管理startproject命令这项测试
  7. CD这项测试/
  8. 蟒蛇manage.py的runserver 0.0.0.0:8001

执行系统检查...

系统检查确定没有任何问题(0静音)。

2017年10月11日 - 15点57分18秒的Django版本1.11.6,使用设置

'thistest.settings' 启动开发服务器在

http://0.0.0.0:8001/退出与CONTROL-C服务器。

一切正常,请检查您是否遵循相同的步骤

+0

谢谢Mattia。我按照以上顺序遵循相同的命令。但它不起作用。所以卸载Python并安装python 3.x,现在它正在工作。感谢帮助。 – iamsumesh

相关问题