我想在本地系统的主机名上运行Django服务器。 Django有自己的服务器......运行在localhost:8000
我只想让它在
cpanel-django.django-project.com:8000
我尝试使用:
python manage.py runserver cpanel-django.django-project.com:8000
我收到此错误:
Validating models...
0 errors found
March 06, 2014 - 06:21:24
Django version 1.6.2, using settings 'moclient.settings'
Starting development server at http://cpanel-django.django-project.com:8383/
Quit the server with CONTROL-C.
Error: [Errno -5] No address associated with hostname
答案 0 :(得分:0)
您需要编辑hosts文件并将localhost
重命名为cpanel-django.django-project.com
。
答案 1 :(得分:0)
对于每个主机名,系统中都有IP地址映射,因此您无需担心IP地址,只需要记住主机名。
如何在系统中添加主机名?
检查此维基:Host file content
在系统中找到文件的位置?
提到here
中不同系统中文件的位置答案 2 :(得分:0)
对于Windows,您可以在
中的hosts文件中进行输入C:\ Windows \ System32 \ drivers \ etc \ hosts
并使用
更新文件127.0.0.1 cpanel-django.django-project.com:8383
如果您在端口80上运行
127.0.0.1 cpanel-django.django-project.com