[RFC] add a config PREFIX

Kumar Gala galak at kernel.crashing.org
Tue Jan 6 02:00:18 EST 2009


On Dec 18, 2008, at 5:02 PM, Kumar Gala wrote:

> This was my starts at attemting having the ability to have a PREFIX  
> in the
> top level settings if you don't have patchworks running at root of  
> your
> webserver.
>
> We have it on http://site/patchwork/...
>
> It wasn't clear to me yet how to tweak htdocs/css/style.css and
> templates/base.html to use this as well.
>
> - k

Jeremy,

Any comments on this?

- k

>
>
>
> diff --git a/apps/urls.py b/apps/urls.py
> index 5c4ac57..735958b 100644
> --- a/apps/urls.py
> +++ b/apps/urls.py
> @@ -27,25 +27,25 @@ from patchwork.utils import  
> userprofile_register_callback
>
> urlpatterns = patterns('',
>     # Example:
> -    (r'^', include('patchwork.urls')),
> +    (r'^' + settings.PREFIX, include('patchwork.urls')),
>
>     # override the default registration form
> -    url(r'^accounts/register/$',
> +    url(r'^' + settings.PREFIX + r'accounts/register/$',
>         register,
>         {'form_class': RegistrationForm,
>          'profile_callback': userprofile_register_callback},
>         name='registration_register'),
>
> -    (r'^accounts/', include('registration.urls')),
> +    (r'^' + settings.PREFIX + r'accounts/',  
> include('registration.urls')),
>
>     # Uncomment this for admin:
> -     (r'^admin/(.*)', admin_site.root),
> -
> -     (r'^css/(?P<path>.*)$', 'django.views.static.serve',
> -        {'document_root': '/srv/patchwork/htdocs/css'}),
> -     (r'^js/(?P<path>.*)$', 'django.views.static.serve',
> -        {'document_root': '/srv/patchwork/htdocs/js'}),
> -     (r'^images/(?P<path>.*)$', 'django.views.static.serve',
> -        {'document_root': '/srv/patchwork/htdocs/images'}),
> +     (r'^' + settings.PREFIX + r'admin/(.*)', admin_site.root),
> +
> +     (r'^' + settings.PREFIX + r'css/(?P<path>.*)$',  
> 'django.views.static.serve',
> +        {'document_root': '/opt/patchwork/htdocs/css'}),
> +     (r'^' + settings.PREFIX + r'js/(?P<path>.*)$',  
> 'django.views.static.serve',
> +        {'document_root': '/opt/patchwork/htdocs/js'}),
> +     (r'^' + settings.PREFIX + r'images/(?P<path>.*)$',  
> 'django.views.static.serve',
> +        {'document_root': '/opt/patchwork/htdocs/images'}),
> )
>
> _______________________________________________
> Patchwork mailing list
> Patchwork at ozlabs.org
> https://ozlabs.org/mailman/listinfo/patchwork




More information about the Patchwork mailing list