Windows下配置Nginx代理Django

Windows下配置Nginx代理Django

一、 安装djanjo

1、下载源码

https://www.djangoproject.com/download/

本文下载的djanjo版本为1.5.1,下载链接如下:

https://www.djangoproject.com/m/releases/1.5/Django-1.5.1.tar.gz

2、安装

进入源码目录执行以下命令:

python setup.py install

3、验证djanjo

>>> import django
>>> print(django.__path__)
['C:\\Python27\\lib\\site-packages\\django']
>>> print(django.get_version())
1.5.1

二、用djanjo生成简单web页面

1、添加环境变量

将文件django-admin.py所在目录“C:\Python27\Scripts”加入path变量。

2、创建djanjo项目

django-admin.py startproject testSite1 # 创建diango项目testSite1
cd testSite1
manage.py runserver 8090  # 在8090端口提供服务

3、运行效果

这里可以通过127.0.0.1进行访问,但不能通过本机的局域网ip等进行访问。

三、用nginx进行代理

1、下载nginx

网址:http://nginx.org/en/download.html

本文所使用的nginx版本链接:http://nginx.org/download/nginx-1.4.1.zip

2、配置nginx

进入conf文件夹,打开nginx.conf文件,添加(或修改为)如下内容:

复制代码
server {
    listen       80; # 注意端口占用问题

    location / {
        proxy_pass http://127.0.0.1:8090;                       
    }        
}
复制代码

3、运行效果

从图中可以看到,虚拟机可以通过ip地址正常访问网站。

E-Mail : Mike_Zhang@live.com
 
分类: python
标签: python

C++代码风格检查

 
  1. 背景

    C++ 是 Google 大部分开源项目的主要编程语言. 正如每个 C++ 程序员都知道的, C++ 有很多强大的特性, 但这种强大不可避免的导致它走向复杂,使代码更容易产生 bug, 难以阅读和维护.

    为了加强代码的一致性,保持统一编程风格,使任何程序员都可以快速读懂你的代码,Google开发了一个C++代码风格检查工具(cpplint),但是该工具仅仅将检查结果输出到控制台,并不很容易读,也并不能很好的和代码结合在一起展示。没有一个html页面的检查报表,也不利于jenkins的集成展示,在这种强大的需求下,Cppstyle这款工具就诞生了。Cppstyle对原有工具的控制台输出做了,从繁杂的检查结果字符串中提出关键信息,结合代码文件,输出了html页面。简洁的页面,更方便的编码人员进行代码风格的修改。

  2. 工具介绍

    该工具在Google原有工具的基础上做了如下几点的改进:

    1. 支持对一个目录底下的所有源文件进行代码检查,同时支持针对一个源文件的代码检查

    2. 支持检查规则的定制,可以在当前目录底下的filter.sdp文件里指定检查规则,通过设置检查规则,可以将不需要检查的规则过滤掉,规则以逗号分隔

    3. 支持html页面展示

  3.  使用方法

    python Gaara.py -s sourcefile > result.html

    检查规则过滤:可在当前目录下filter.sdp设置,并以逗号分隔

    example:

     -whitespace,+whitespace/braces

    将过滤规则为whitespace,但是保留规则whitespace/braces,未指定规则默认保留。目前Google原始工具支持的规则如下:  

   

复制代码
'build/class',
  'build/deprecated',
  'build/endif_comment',
  'build/explicit_make_pair',
  'build/forward_decl',
  'build/header_guard',
  'build/include',
  'build/include_alpha',
  'build/include_order',
  'build/include_what_you_use',
  'build/namespaces',
  'build/printf_format',
  'build/storage_class',
  'legal/copyright',
  'readability/alt_tokens',
  'readability/braces',
  'readability/casting',
  'readability/check',
  'readability/constructors',
  'readability/fn_size',
  'readability/function',
  'readability/multiline_comment',
  'readability/multiline_string',
  'readability/namespace',
  'readability/nolint',
  'readability/streams',
  'readability/todo',
  'readability/utf8',
  'runtime/arrays',
  'runtime/casting',
  'runtime/explicit',
  'runtime/int',
  'runtime/init',
  'runtime/invalid_increment',
  'runtime/member_string_references',
  'runtime/memset',
  'runtime/operator',
  'runtime/printf',
  'runtime/printf_format',
  'runtime/references',
  'runtime/rtti',
  'runtime/sizeof',
  'runtime/string',
  'runtime/threadsafe_fn',
  'whitespace/blank_line',
  'whitespace/braces',
  'whitespace/comma',
  'whitespace/comments',
  'whitespace/empty_loop_body',
  'whitespace/end_of_line',
  'whitespace/ending_newline',
  'whitespace/forcolon',
  'whitespace/indent',
  'whitespace/labels',
  'whitespace/line_length',
  'whitespace/newline',
  'whitespace/operators',
  'whitespace/parens',
  'whitespace/semicolon',
  'whitespace/tab',
  'whitespace/todo'
复制代码

  4.  创新点

    1. html页面展示,帮助开发人员,从繁杂的检查结果中解放出来,更加方便RD修改自己的代码

    2. 可定制检查规则,方便开发人员过滤不需要检查的规则

    2.  可以和持续集成jenkins融合在一起,目前已有RD使用。QA检查RD的代码风格。

    

    

 
 
原文地址:https://www.cnblogs.com/Leo_wl/p/3137884.html