urls.py 2.34 KB
Newer Older
David Haynes's avatar
David Haynes committed
1 2 3 4
"""
settings/urls.py
"""

5
# Future Imports
David Haynes's avatar
David Haynes committed
6 7
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)
8

9
# Django Imports
David Haynes's avatar
David Haynes committed
10
import django.contrib.auth.views
David Haynes's avatar
David Haynes committed
11
from django.conf.urls import url
12
from django.contrib import admin
Grady Moran's avatar
Grady Moran committed
13
from django.views.decorators.cache import cache_page
14 15 16 17
from django.views.generic import TemplateView

# App Imports
import go.views
18

19 20
# This function attempts to import an admin module in each installed
# application. Such modules are expected to register models with the admin.
21 22
admin.autodiscover()

23
# Main list of project URL's
David Haynes's avatar
David Haynes committed
24
urlpatterns = [
David Haynes's avatar
David Haynes committed
25 26
    # / - Homepage url. Cached for 1 second (this is the page you see after
    # logging in, so having it show as not logged in is strange)
27
    url(r'^$', cache_page(1)(go.views.index), name='index'),
28

29
    # /view/<short> - View URL data. Cached for 15 minutes
Grady Moran's avatar
Grady Moran committed
30
    url(r'^view/(?P<short>[-\w]+)$', cache_page(60*15)(go.views.view), name='view'),
31

32
    # /about - About page. Cached for 15 minutes
Grady Moran's avatar
Grady Moran committed
33
    url(r'^about/?$', cache_page(60*15)(TemplateView.as_view(template_name='core/about.html')),
34
        name='about'),
35

36 37
    # /signup - Signup page for access. Cached for 15 minutes
    url(r'^signup/?$', cache_page(60*15)(go.views.signup), name='signup'),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
38

39
    # /newLink - My-Links page, view and review links.
Zach Knox's avatar
Zach Knox committed
40
    url(r'^newLink/?$', go.views.new_link, name='new_link'),
41

42
    # /myLinks - My-Links page, view and review links.
43
    url(r'^myLinks/?$', go.views.my_links, name='my_links'),
44

Jean Michel Rouly's avatar
Jean Michel Rouly committed
45
    # /delete/<short> - Delete a link, no content display.
46
    url(r'^delete/(?P<short>[-\w]+)$', go.views.delete, name='delete'),
47

48
    # /registered - registration complete page. Cached for 15 minutes
Grady Moran's avatar
Grady Moran committed
49
    url(r'^registered/?$', cache_page(60*15)(TemplateView.as_view(template_name='registered.html')),
50
        name='registered'),
51

52
    # /admin - Administrator interface.
53
    url(r'^admin/?', admin.site.urls, name='go_admin'),
54

Chris Reffett's avatar
Chris Reffett committed
55
    # /useradmin - user approval interface
David Haynes's avatar
David Haynes committed
56 57
    url(r'^useradmin/?$', go.views.useradmin, name='useradmin'),
]
58 59

# Handle authentication pages
David Haynes's avatar
David Haynes committed
60 61 62 63 64 65
urlpatterns += [
    # Auth pages
    url(r'^login$', django.contrib.auth.views.login, name='go_login'),
    url(r'^logout$', django.contrib.auth.views.logout, {'next_page': '/'},
        name='go_logout'),
]
Jean Michel Rouly's avatar
Jean Michel Rouly committed
66

David Haynes's avatar
David Haynes committed
67
urlpatterns += [
Jean Michel Rouly's avatar
Jean Michel Rouly committed
68
    # Redirection regex.
Robert Hitt's avatar
Robert Hitt committed
69
    url(r'^(?P<short>[-\w]+)$', go.views.redirection, name='redirection'),
David Haynes's avatar
David Haynes committed
70
]