Projects tagged ‘django’ and ‘middleware’


Jump to tag:

Projects tagged ‘django’ and ‘middleware’

Filtered by Project Tags django middleware

Refine results Project Tags python (9) mobile (3) cellphone (2) css (2) context_processor (2) plugin (2) device (1) ajax (1) debug (1) gae (1) wordpress (1) themes (1)

[19 total ]

1 Users

Cookies are great, but inherently insecure. This app provides a convenient way to tighten them up to the point they can be trusted.
Created over 2 years ago.

1 Users

Django-flash is a simple extension to the Django framework which enables the use of the so called flash scope, first introduced by Ruby on Rails a few years ago.
Created about 1 year ago.

1 Users

Django maintenance mode is a middleware that allows you to temporary shutdown your site and display a maintenance page for users of your site, while still being able to fully use the site yourself. ... [More] For more information please look at: http://pypi.python.org/pypi/django-maintenancemode/ [Less]
Created about 1 year ago.

0 Users

Ever wanted something like environment variables for your Django app? Something along the lines of $USER, $HOME or any other arbitrary $VARIABLE from which you could pull data? Django-environment ... [More] is a system to provide environment variables to django apps. It accomplishes this through middleware and a number of "variable generators" that generate values for specified variables. The environment variables are then easily accessible anywhere within the executing request thread, or from within the template. Variable generators are available for most common cases, and its a simple matter to create new variable generators. Getting StartedStart with the Installation page. Learn how to set up your environment with EnvironmentFiles Learn how to access your environment with AccessingEnvironmentVariables [Less]
Created 12 months ago.

0 Users

Django CASdjango_cas is a CAS 1.0 and CAS 2.0 authentication backend for Django. It allows you to use Django's built-in authentication mechanisms and User model while adding support for CAS. It also ... [More] includes a middleware that intercepts calls to the original login and logout pages and forwards them to the CASified versions, and adds CAS support to the admin interface. InstallationRun python setup.py install, or place the django_cas directory in your PYTHONPATH directly. (Note: If you're using Python 2.4 or older, you'll need to install ElementTree to use CAS 2.0 functionality.) Now add it to the middleware and authentication backends in your settings. Make sure you also have the authentication middleware installed. Here's what mine looks like: MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django_cas.middleware.CASMiddleware', 'django.middleware.doc.XViewMiddleware', ) AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', 'django_cas.backends.CASBackend', )Set the following required setting in settings.py: CAS_SERVER_URL: This is the only setting you must explicitly define. Set it to the base URL of your CAS source (e.g. http://sso.some.edu/cas/). Optional settings include: CAS_ADMIN_PREFIX: The URL prefix of the Django administration site. If undefined, the CAS middleware will check the view being rendered to see if it lives in django.contrib.admin.views. CAS_IGNORE_REFERER: If True, logging out of the application will always send the user to the URL specified by CAS_REDIRECT_URL. CAS_LOGOUT_COMPLETELY: If False, logging out of the application won't log the user out of CAS as well. CAS_REDIRECT_URL: Where to send a user after logging in or out if there is no referrer and no next page set. Default is /. CAS_VERSION: The CAS protocol version to use. '1' and '2' are supported, with '2' being the default. Make sure your project knows how to log users in and out by adding these to your URL mappings: (r'^accounts/login/$', 'django_cas.views.login'), (r'^accounts/logout/$', 'django_cas.views.logout'),Users should now be able to log into your site (and staff into the administration interface) using CAS. Populating User DataTo add user data, subclass CASBackend and specify that as your application's backend. For example: from django_cas.backends import CASBackend class PopulatedCASBackend(CASBackend): """CAS authentication backend with user data populated from AD""" def authenticate(self, ticket, service): """Authenticates CAS ticket and retrieves user data""" user = super(PopulatedCASBackend, self).authenticate( ticket, service) # Connect to AD, modify user object, etc. return userPreventing Infinite RedirectsDjango's current implementation of its permission_required and user_passes_test decorators (in django.contrib.auth.decorators) has a known issue that can cause users to experience infinite redirects. The decorators return the user to the login page, even if they're already logged in, which causes a loop with SSO services like CAS. django_cas provides fixed versions of these decorators in django_cas.decorators. Usage is unchanged, and in the event that this issue is fixed, the decorators should still work without issue. For more information see http://code.djangoproject.com/ticket/4617. Customizing the 403 Error PageDjango doesn't provide a simple way to customize 403 error pages, so you'll have to make a response middleware that handles HttpResponseForbidden. For example, in views.py: from django.http import HttpResponseForbidden from django.template import RequestContext, loader def forbidden(request, template_name='403.html'): """Default 403 handler""" t = loader.get_template(template_name) return HttpResponseForbidden(t.render(RequestContext(request)))And in middleware.py: from django.http import HttpResponseForbidden from yourapp.views import forbidden class Custom403Middleware(object): """Catches 403 responses and renders 403.html""" def process_response(self, request, response): if isinstance(response, HttpResponseForbidden): return forbidden(request) else: return responseNow add yourapp.middleware.Custom403Middleware to your MIDDLEWARE_CLASSES setting and create a template named 403.html. CAS 2.0 supportThe CAS 2.0 protocol is supported in the same way that 1.0 is; no extensions or new features from the CAS 2.0 specification are implemented. elementtree is required to use this functionality. (elementtree is also included in Python 2.5's standard library.) Note: The CAS 3.x server uses the CAS 2.0 protocol. There is no CAS 3.0 protocol, though the CAS 3.x server does allow extensions to the protocol. Differences Between Django CAS 1.0 and 2.0Version 2.0 of django_cas breaks compatibility in some small ways, in order simplify the library. The following settings have been removed: CAS_LOGIN_URL and CAS_LOGOUT_URL: Version 2.0 is capable of determining these automatically. CAS_POPULATE_USER: Subclass CASBackend instead (see above). CAS_REDIRECT_FIELD_NAME: Django's own REDIRECT_FIELD_NAME is now used unconditionally. [Less]
Created about 1 year ago.

0 Users

Django and AJAXThis middleware is another attemp to simplify AJAX usage with Django based on JSON-RPC specification (http://json-rpc.org/). It inspired by Java Struts2 JSON-plugin by Musachy Barroso ... [More] (http://cwiki.apache.org/S2PLUGINS/json-plugin.html) and SimpleJSONRPCServer by David McNab (http://code.djangoproject.com/wiki/JSON-RPC). Some documentation can be found here: http://code.djangoproject.com/wiki/JSONRPCServerMiddleware Usage example (see it with firebug): http://alx3apps.appspot.com/jsonrpc_example/ [Less]
Created 12 months ago.

0 Users

Extends the django history functionallity to include the following: Track changes made outside of the admin Track before and after values Persist even after user has been deleted Overide django ... [More] admin view for the Models it is enabled for New version 0.3: Django 1.1 and Django 1.0 Compatible Unit testing Migrated to simplejson for better unicode support Admin features not supported in Django 1.0 Improved admin interface Installation: easy_install fullhistory or simply download it [Less]
Created 11 months ago.

0 Users

add ?prof to any view in your django instance to see profiling data for example, if you wanted to see profiling data for: www.example.com/blog/ you would simply install django-profiler and go to ... [More] www.example.com/blog/?prof All profiling data generated by adding the "prof" GET request is also saved into the database for later analysis Django-loggingThe Django logging project has a nicer, more feature-filled and most importantly: actively developed django profiling app [Less]
Created 4 months ago.

0 Users

整合wordpress的用户到django项目 安装说明Python 2.5.4 / Django 1.1 / Wordpress 2.8.4 测试通过 http://code.google.com/p/wp-auth/wiki/Readme_CN 下载Win32 ... [More] http://wp-auth.googlecode.com/files/wp-auth_v0.2.zip Linux http://wp-auth.googlecode.com/files/wp-auth_v0.2.tar.gz [Less]
Created 2 months ago.

0 Users

This tool uses common DNS blacklists in a middleware class to block unsolicited visitors.
Created about 1 year ago.