django-uwsgi-admin-grappelli / uwsgi_admin /

import uwsgi
import time
from django.contrib.auth.decorators import user_passes_test
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect

@user_passes_test(lambda u: u.is_superuser)
def index(request):
    workers = uwsgi.workers()
    total_load = time.time() - uwsgi.started_on
    for w in workers:
        w['load'] = (100 * (w['running_time'] / 1000)) / total_load
        w['last_spawn_str'] = time.ctime(w['last_spawn'])

    jobs = []
    if 'spooler' in uwsgi.opt:
        spooler_jobs = uwsgi.spooler_jobs()
        for j in spooler_jobs:
            jobs.append({'file': j, 'env': uwsgi.parsefile(j)})

    return render_to_response('admin/uwsgi.html', {
        'masterpid': uwsgi.masterpid(),
        'started_on': time.ctime(uwsgi.started_on),
        'buffer_size': uwsgi.buffer_size,
        'total_requests': uwsgi.total_requests(),
        'numproc': uwsgi.numproc,
        'workers': workers,
        'jobs': jobs,
        'title': 'uWSGI status',
    }, RequestContext(request, {}))

@user_passes_test(lambda u: u.is_superuser)
def reload(request):
    if uwsgi.masterpid() > 0:
        request.user.message_set.create(message="uWSGI reloaded")
            message="The uWSGI master process is not active")

    return HttpResponseRedirect(reverse(index))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.