简体   繁体   中英

python manage.py runserver throwing error

I am new to python. I gave the following commands:

django-admin startproject webserver

This created a skeleton project. After this, I ran

python manage.py runserver 0.0.0.0:8001

I am getting the error given below. I am not able to start server. Please guide me?

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),

You probably miss some steps during the correct creation. I just tested it on my machine with this steps:

  1. mkdir test
  2. cd test/
  3. virtualenv testing (for me will create a python 2.7 env)
  4. source testing/bin/activate
  5. pip install django
  6. django-admin startproject thistest
  7. cd thistest/
  8. python manage.py runserver 0.0.0.0:8001

Performing system checks...

System check identified no issues (0 silenced).

October 11, 2017 - 15:57:18 Django version 1.11.6, using settings

'thistest.settings' Starting development server at

http://0.0.0.0:8001/ Quit the server with CONTROL-C.

everything works fine, please check if you followed the same steps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM