Ejemplo n.º 1
0
from django.conf import settings
from django.conf.urls.defaults import patterns, include
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

from .examples import urls

from funfactory.monkeypatches import patch
patch()

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Example:
    (r'', include(urls)),
    (r'^browserid/', include('django_browserid.urls')),

    # Generate a robots.txt
    (r'^robots\.txt$',
        lambda r: HttpResponse(
            "User-agent: *\n%s: /" % 'Allow' if settings.ENGAGE_ROBOTS else 'Disallow' ,
            mimetype="text/plain"
        )
    ),

    # Uncomment the admin/doc line below to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    (r'^admin/', include(admin.site.urls)),
Ejemplo n.º 2
0
from django.conf import settings
from django.conf.urls.defaults import include, patterns, url
from django.contrib import admin
from django.shortcuts import render
from django.views.decorators.cache import cache_page
from django.views.i18n import javascript_catalog

import autocomplete_light

from funfactory.monkeypatches import patch

from mozillians.common.decorators import allow_public

# Funfactory monkeypatches
patch()

autocomplete_light.autodiscover()
admin.autodiscover()

# From socorro
# funfactory puts the more limited CompressorExtension extension in
# but we need the one from jingo_offline_compressor.jinja2ext otherwise we
# might an error like this:
#
# AttributeError: 'CompressorExtension' object has no attribute 'nodelist'
#
from jingo_offline_compressor.jinja2ext import CompressorExtension
import jingo
try:
    jingo.env.extensions.pop(
        'compressor.contrib.jinja2ext.CompressorExtension')
Ejemplo n.º 3
0
from django.conf import settings
from django.conf.urls.defaults import *

from .profiles import urls as profiles_urls

from django.views.generic.simple import direct_to_template

from funfactory import monkeypatches
monkeypatches.patch()

import badger
badger.autodiscover()

from django.contrib import admin
admin.autodiscover()

from badger import Progress
#from badger_multiplayer.models import Badge, Award, Nomination
from badger.models import Badge, Award

urlpatterns = patterns(
    '',
    url(r'^$', 'badger.views.home', name='home'),
    (r'^notification/', include('notification.urls')),
    (r'^badges/', include('badger_multiplayer.urls')),
    (r'^badges/', include('badger.urls')),
    (r'^browserid/', include('django_browserid.urls')),
    (r'^profiles/', include(profiles_urls)),
    (r'^accounts/', include('django.contrib.auth.urls')),
    (r'^admin/', include(admin.site.urls)),
)
Ejemplo n.º 4
0
from django.conf import settings
from django.conf.urls.defaults import *

from .profiles import urls as profiles_urls

from django.views.generic.simple import direct_to_template

from funfactory import monkeypatches
monkeypatches.patch()

import badger
badger.autodiscover()

from django.contrib import admin
admin.autodiscover()

from badger import Progress
from badger.models import Badge, Award

urlpatterns = patterns('',
    url(r'^$', 'badger.views.home', name='home'),
    (r'^notification/', include('notification.urls')),
    #(r'^$', include('badgus.base.urls')),
    (r'^badges/create$', 'badgus.base.views.create'),
    (r'^badges/', include('badgus.badger_api.urls')),
    (r'^badges/', include('badger.urls')),
    (r'^profiles/', include(profiles_urls)),
    (r'^accounts/', include('django.contrib.auth.urls')),
    (r'^keys/', include('valet_keys.urls')),
    (r'^admin/', include(admin.site.urls)),
    (r'^', include('django_browserid.urls')),
Ejemplo n.º 5
0
    def begin(self):
        if os.path.exists(ENVIRONMENT_NOTE):
            if self._read_last_environment() != self._this_environment():
                shutil.rmtree(PLAYDOH)

        if not os.path.exists(PLAYDOH):
            container = os.path.abspath(os.path.join(PLAYDOH, '..'))
            if not os.path.exists(container):
                os.mkdir(container)
            check_call(['git', 'clone', '--recursive',
                        '--branch', FF_PLAYDOH_BRANCH,
                        FF_PLAYDOH_REMOTE,
                        PLAYDOH])
        else:

            proj_sh = partial(shell, cwd=PLAYDOH)
            proj_sh('git pull origin %s' % FF_PLAYDOH_BRANCH)
            proj_sh('git submodule sync -q')
            proj_sh('git submodule update --init --recursive')

        self._write_last_environment()

        st = os.path.join(PLAYDOH, 'project', 'settings', 'local.py')
        if os.path.exists(st):
            os.unlink(st)
        shutil.copy(os.path.join(PLAYDOH, 'project', 'settings',
                                 'local.py-dist'),
                    st)

        with open(st, 'r') as f:
            new_st = f.read()
            new_st = new_st.replace("'USER': '******'",
                                    "'USER': '******'" % DB_USER)
            new_st = new_st.replace("'PASSWORD': ''",
                                    "'PASSWORD': '******'" % DB_PASS)
            new_st = new_st.replace("'NAME': 'playdoh_app'",
                                    "'NAME': '%s'" % DB_NAME)
            new_st = new_st.replace("SECRET_KEY = ''",
                                    "SECRET_KEY = 'testinglolz'")
            new_st = new_st + "\nfrom . import base\nINSTALLED_APPS = list(base.INSTALLED_APPS) + " \
                     "['django.contrib.admin']\n"

        with open(st, 'w') as f:
            f.write(new_st)

        extra = ''
        if DB_PASS:
            extra = '--password=%s' % DB_PASS
        shell('mysql -u %s %s -e "create database if not exists %s"'
              % (DB_USER, extra, DB_NAME))
        check_call([sys.executable, 'manage.py', 'syncdb', '--noinput'],
                   cwd=PLAYDOH)

        # For in-process tests:
        wd = os.getcwd()
        os.chdir(PLAYDOH)  # Simulate what happens in a real app.
        os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
        try:
            manage.setup_environ(os.path.join(PLAYDOH, 'manage.py'))
        finally:
            os.chdir(wd)
        # Puts path back to this dev version of funfactory:
        sys.path.insert(0, ROOT)

        # simulate what django does, which is to import the root urls.py
        # once everything has been set up (e.g. setup_environ())
        from funfactory.monkeypatches import patch
        patch()
Ejemplo n.º 6
0
    def begin(self):
        if os.path.exists(ENVIRONMENT_NOTE):
            if self._read_last_environment() != self._this_environment():
                shutil.rmtree(PLAYDOH)

        if not os.path.exists(PLAYDOH):
            container = os.path.abspath(os.path.join(PLAYDOH, '..'))
            if not os.path.exists(container):
                os.mkdir(container)
            check_call(['git', 'clone', '--recursive',
                        '--branch', FF_PLAYDOH_BRANCH,
                        FF_PLAYDOH_REMOTE,
                        PLAYDOH])
        else:

            proj_sh = partial(shell, cwd=PLAYDOH)
            proj_sh('git pull origin %s' % FF_PLAYDOH_BRANCH)
            proj_sh('git submodule sync -q')
            proj_sh('git submodule update --init --recursive')

        self._write_last_environment()

        st = os.path.join(PLAYDOH, 'project', 'settings', 'local.py')
        if os.path.exists(st):
            os.unlink(st)
        shutil.copy(os.path.join(PLAYDOH, 'project', 'settings',
                                 'local.py-dist'),
                    st)

        with open(st, 'r') as f:
            new_st = f.read()
            new_st = new_st.replace("'USER': '******'",
                                    "'USER': '******'" % DB_USER)
            new_st = new_st.replace("'PASSWORD': ''",
                                    "'PASSWORD': '******'" % DB_PASS)
            new_st = new_st.replace("'HOST': ''",
                                    "'HOST': '%s'" % DB_HOST)
            new_st = new_st.replace("'NAME': 'playdoh_app'",
                                    "'NAME': '%s'" % DB_NAME)
            new_st = new_st.replace("SECRET_KEY = ''",
                                    "SECRET_KEY = 'testinglolz'")
            new_st = new_st + "\nfrom . import base\nINSTALLED_APPS = list(base.INSTALLED_APPS) + " \
                     "['django.contrib.admin']\n"
            new_st = new_st + "\nSITE_URL = ''\n"

        with open(st, 'w') as f:
            f.write(new_st)

        extra = ''
        if DB_PASS:
            extra = '--password=%s' % DB_PASS
        if DB_HOST:
            extra += ' -h %s' % DB_HOST
        shell('mysql -u %s %s -e "create database if not exists %s"'
              % (DB_USER, extra, DB_NAME))
        check_call([sys.executable, 'manage.py', 'syncdb', '--noinput'],
                   cwd=PLAYDOH)

        # For in-process tests:
        wd = os.getcwd()
        os.chdir(PLAYDOH)  # Simulate what happens in a real app.
        os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
        try:
            manage.setup_environ(os.path.join(PLAYDOH, 'manage.py'))
        finally:
            os.chdir(wd)
        # Puts path back to this dev version of funfactory:
        sys.path.insert(0, ROOT)

        # simulate what django does, which is to import the root urls.py
        # once everything has been set up (e.g. setup_environ())
        from funfactory.monkeypatches import patch
        patch()
Ejemplo n.º 7
0
from django.conf import settings
from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.http import HttpResponse

from django_browserid.admin import site as browserid_admin_site
from funfactory.monkeypatches import patch


patch()  # Apply funfactory monkeypatches.
admin.autodiscover()  # Discover admin.py files for the admin interface.

# Copy ModelAdmin entries from the default admin site.
browserid_admin_site.copy_registry(admin.site)

urlpatterns = patterns('',
    (r'', include('nucleus.base.urls')),

    url(r'^admin/', include(browserid_admin_site.urls)),
    url(r'^api-token-auth/', 'rest_framework.authtoken.views.obtain_auth_token'),
    url(r'^rna/', include('rna.urls')),

    (r'', include('django_browserid.urls')),

    (r'^robots\.txt$',
        lambda r: HttpResponse(
            "User-agent: *\n%s: /" % 'Allow' if settings.ENGAGE_ROBOTS else 'Disallow' ,
            mimetype="text/plain"
        )
    ),