# mysite_nginx.conf
# the upstream component nginx needs to connect to
upstream django {
# server unix:///path/to/your/mysite/mysite.sock; # for a file socket
server 127.0.0.1:9000; # for a web port socket (we'll use this first)
}
# configuration of the server
server {
# the port your site will be served on
listen 8001;
# the domain name it will serve for
server_name .example.com; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
location /static {
root /data/wwwroot/traffic_scheduling/web/; # your Django project's static files - amend as required
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include uwsgi_params; # the uwsgi_params file you installed
}
}
Django运行访问项目出现的问题:DisallowedHost at / Invalid HTTP_HOST header:
DisallowedHost at / Invalid HTTP_HOST header: ‘10.211.55.6:8000’. You may need to add u’10.211.55.6′ to ALLOWED_HOSTS.
Request Method: GET Request URL: http://10.211.55.6:8000/ Django Version: 1.10.4 Exception Type: DisallowedHost Exception Value: Invalid HTTP_HOST header: ‘10.211.55.6:8000’. You may need to add u’10.211.55.6′ to ALLOWED_HOSTS. Exception Location: /usr/lib/python2.7/site-packages/django/http/request.py in get_host, line 113 Python Executable: /usr/bin/python Python Version:
D:\jsite>python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying sessions.0001_initial... OK
D:\jsite>python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
October 24, 2018 - 21:53:21
Django version 2.1.2, using settings 'jsite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
浏览器打开http://127.0.0.1:8000/,看到“The install worked successfully! Congratulations!”字样说明成功。千万不要 将这个服务器用于和生产环境相关的任何地方。这个服务器只是为了开发而设计的。
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.39/containers/json?all=1: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
这个问题好坑,找了好久都没有解决办法,卸载重装以后还是不行。
注:卸载后将会删除所有镜像及虚拟机容器。
解决办法
在 cmd.exe 中执行,开启守护进程即可。
cd "C:\Program Files\Docker\Docker"
./DockerCli.exe -SwitchDaemon