简体   繁体   中英

Running Django server (Python 3.4)

I tried today to install Django for Python 3.4. I managed to create a project but when I try to run the server with python manage.py runserver (I'm on Windows 7), I get an error :

Performing system checks...

System check identified no issues (0 silenced).

You have unapplied migrations; your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them.
December 29, 2014 - 14:51:44
Django version 1.7.1, using settings 'sdz.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Unhandled exception in thread started by <function check_errors.<locals>.wrappe
 at 0x00000000043D3268>
Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\django\utils\autoreload.py", line 222, in
wrapper
    fn(*args, **kwargs)
  File "C:\Python34\lib\site-packages\django\core\management\commands\runserver
py", line 134, in inner_run
    ipv6=self.use_ipv6, threading=threading)
  File "C:\Python34\lib\site-packages\django\core\servers\basehttp.py", line 16
, in run
    httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
  File "C:\Python34\lib\site-packages\django\core\servers\basehttp.py", line 11
, in __init__
    super(WSGIServer, self).__init__(*args, **kwargs)
  File "C:\Python34\lib\socketserver.py", line 430, in __init__
    self.server_bind()
  File "C:\Python34\lib\site-packages\django\core\servers\basehttp.py", line 12
, in server_bind
    super(WSGIServer, self).server_bind()
  File "C:\Python34\lib\wsgiref\simple_server.py", line 50, in server_bind
    HTTPServer.server_bind(self)
  File "C:\Python34\lib\http\server.py", line 137, in server_bind
    self.server_name = socket.getfqdn(host)
  File "C:\Python34\lib\socket.py", line 460, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 3: invalid
continuation byte

And I can't access my server. How can I run the server ? Thanks,

Run the following command:

manage.py migrate

This will create your tables in your database, then try running your server.

Okay I got it, it was pretty dumb, I just had non-ASCII characters in my hostname. Now it works perfectly !

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