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:
| #include <Python.h> | |
| #include <numpy/arrayobject.h> | |
| #include "chi2.h" | |
| /* Docstrings */ | |
| static char module_docstring[] = | |
| "This module provides an interface for calculating chi-squared using C."; | |
| static char chi2_docstring[] = | |
| "Calculate the chi-squared of some data given a model."; |
| #!/usr/bin/env python | |
| import SimpleHTTPServer | |
| import SocketServer | |
| from optparse import OptionParser | |
| parser = OptionParser() | |
| parser.add_option("-p", | |
| "--port", |
| from os import path | |
| from fabric.api import cd, prefix, lcd | |
| from fabric.api import run, sudo as run_as_root, local as run_on_local | |
| from cuisine import package_install_apt, file_exists | |
| def _run(command, sudo=False, local=False): | |
| if sudo: | |
| return run_as_root(command) |
| from wsgiref.simple_server import make_server, WSGIServer | |
| from SocketServer import ThreadingMixIn | |
| from time import sleep | |
| def simple_app(env, start_response): | |
| status = '200 OK' | |
| headers = [('Content-type', 'text/plain')] | |
| start_response(status, headers) |
| module Vagrant | |
| module Provisioners | |
| class Fabric < Base | |
| class Config < Vagrant::Config::Base | |
| attr_accessor :fabfile_path | |
| attr_accessor :fabric_path | |
| attr_accessor :python_path | |
| attr_writer :tasks | |
| def _default_fabfile_path |
| # Get a list of all the bugs you fixed: | |
| hg log -u [email protected] --template '{date|isodate}: {desc}\n' | |
| # it doesn't filter out the merges, backouts, etc. | |
| # Add this to your hgrc: | |
| [alias] | |
| mybugs = log -u [email protected] --template '{date|isodate}: {desc}\n' | |
| hg mybugs |
| /* Any copyright is dedicated to the Public Domain. | |
| * http://creativecommons.org/publicdomain/zero/1.0/ */ | |
| Components.utils.import("resource:///modules/devtools/gcli.jsm"); | |
| var helloCommandSpec = { | |
| name: 'hello', | |
| description: 'Show a message', | |
| params: [ | |
| { |
| def _simple_processor(processor, ext_private, ext_public): | |
| if not request.path.endswith(ext_public): | |
| return | |
| public_file = request.path[len(config.app.static_url_path) + 1:] | |
| public_file_path = os.path.join(config.app.static_folder, public_file) | |
| private_file_path = public_file_path[:-len(ext_public)] + ext_private | |
| # File does not exist in app static - check blueprints. | |
| if not os.path.isfile(private_file_path): | |
| for blueprint_name, blueprint in config.app.blueprints.iteritems(): | |
| if request.path.startswith(blueprint.static_url_path): |
| # Search for statistic messages from the Python trakcer robot in | |
| # python-dev archives and plot the result. | |
| # | |
| # $ python-traker-stats.py collect | |
| # | |
| # Collects statistics from the mailing list and saves to | |
| # python-tracker-stats.json | |
| # | |
| # $ python-tracker-stats.py plot | |
| # |