This document has now been incorporated into the uWSGI documentation:
http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html
Steps with explanations to set up a server using:
static int establish_proxy_connection(int fd, char *host, int port, | |
char *proxy_user, char *proxy_pass) | |
{ | |
char *cp, buffer[1024]; | |
char *authhdr, authbuf[1024]; | |
int len; | |
if (proxy_user && proxy_pass) { | |
stringjoin(buffer, sizeof buffer, | |
proxy_user, ":", proxy_pass, NULL); |
When VPNs Just Work™, they're a fantastic way of allowing access to a private network from remote locations. When they don't work it can be an experience in frustration. I've had situations where I can connect to a VPN from my Mac, but various networking situations cause routing conflicts. Here are a couple of cases and how I've been able to get around them.
In this example the VPN we are connecting to has a subnet that does not conflict with our local IP, but has additional routes that conflict in some way with our local network's routing. In my example the remote subnet is 10.0.x.0/24, my local subnet is 10.0.y.0/24, and the conflicting route is 10.0.0.0/8. Without the later route, I can't access all hosts on the VPN without manually adding the route after connecting to the VPN:
class Graph: | |
def __init__(self): | |
self.nodes = set() | |
self.edges = defaultdict(list) | |
self.distances = {} | |
def add_node(self, value): | |
self.nodes.add(value) | |
def add_edge(self, from_node, to_node, distance): |
from flask import Flask | |
from flask.ext.sqlalchemy import SQLAlchemy | |
from flask.ext import admin, wtf | |
from flask.ext.admin.contrib import sqlamodel | |
app = Flask(__name__) | |
app.config['SECRET_KEY'] = '123456790' | |
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.sqlite' | |
db = SQLAlchemy(app) |
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
#!/bin/bash | |
sudo date 03050001 | |
# Replace the following line with any application you need to run | |
open /Applications/Merriam-Webster\ 4.0/Merriam-Webster\ Dictionary.app | |
# sleep 60 | |
# Set back to the current time using apple service (network needed) | |
sudo ntpdate -u time.apple.com |
/* | |
* @function: 通过a标签解析url标签 | |
* @param:url url参数是字符串,解析的目标 | |
通过IE6-9 chrome Firefox测试 | |
* | |
*/ | |
function parseURL(url) { | |
//创建一个a标签 | |
var a = document.createElement('a'); |
/** | |
* 阻止事件冒泡的通用函数 | |
* */ | |
function stopBubble(e) { | |
if (e && e.stopPropagation) { | |
e.stopPropagation(); | |
} else { | |
window.event.cancelBubble = true; | |
} | |
} |