Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Got it working

  • Loading branch information...
commit 6d34d6e54da4a0a194e93ccc7f0fde55a2b3a2cf 1 parent 885253c
@blackrobot authored
View
2  manage.py
@@ -3,7 +3,7 @@
import sys
if __name__ == "__main__":
- os.environ.setdefault("DJANGO_SETTINGS_MODULE", "source.settings")
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", 'source.settings')
from django.core.management import execute_from_command_line
View
4 source/settings/defaults.py
@@ -85,7 +85,7 @@
if USE_I18N:
TEMPLATE_CONTEXT_PROCESSORS += ('django.core.context_processors.i18n',)
-ROOT_URLCONF = 'urls'
+ROOT_URLCONF = 'source.urls'
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
@@ -136,7 +136,7 @@ def get_path(*args):
# Local apps
PROJECT_APPS = (
- 'app_utils.bootstrap',
+ 'source.app_utils.bootstrap',
)
INSTALLED_APPS = (
View
2  source/settings/local.py.example → source/settings/local.example.py
@@ -24,7 +24,7 @@
DATABASES = {
'default': {
'ENGINE': "django.db.backends.mysql",
- 'NAME': "",
+ 'NAME': "{{ project_name }}",
'USER': "",
'PASSWORD': "",
},
View
80 source/settings/local.py
@@ -0,0 +1,80 @@
+import sys
+
+from settings.defaults import *
+
+
+DEBUG = LOCAL_SERVE = TEMPLATE_DEBUG = True
+
+SECRET_KEY = "{{ secret_key }}"
+
+# python -m smtpd -n -c DebuggingServer localhost:1025
+EMAIL_HOST = "localhost"
+EMAIL_PORT = 1025
+
+if len(set(sys.argv) & set(('test', 'zen'))) > 0:
+ # Running tests, so just use a sqlite db
+ DATABASES = {
+ 'default': {
+ 'ENGINE': "django.db.backends.sqlite3",
+ 'NAME': "test.db",
+ },
+ }
+else:
+ # Real database when not testing
+ DATABASES = {
+ 'default': {
+ 'ENGINE': "django.db.backends.mysql",
+ 'NAME': "{{ project_name }}",
+ 'USER': "root",
+ 'PASSWORD': "root",
+ },
+ }
+
+# Dummy cache for dev
+CACHES = {
+ 'default': {
+ 'BACKEND': "django.core.cache.backends.dummy.DummyCache",
+ },
+}
+
+# DB backed sessions for testing since cache dumps itself
+SESSION_ENGINE = "django.contrib.sessions.backends.db"
+
+INSTALLED_APPS += (
+ 'debug_toolbar',
+)
+MIDDLEWARE_CLASSES += (
+ 'debug_toolbar.middleware.DebugToolbarMiddleware',
+)
+INTERNAL_IPS = ('127.0.0.1',)
+
+
+# Debug Toolbar
+def show_toolbar(request):
+ if 'debug' in request.GET:
+ on = request.GET.get('debug') == "on"
+ request.session['show_toolbar'] = on
+ elif 'show_toolbar' in request.session:
+ on = request.session['show_toolbar']
+ else:
+ on = False
+ request.session['show_toolbar'] = on
+
+ return not request.path.startswith(ADMIN_NAMESPACE) and on
+
+DEBUG_TOOLBAR_PANELS = (
+ 'debug_toolbar.panels.version.VersionDebugPanel',
+ 'debug_toolbar.panels.timer.TimerDebugPanel',
+ 'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
+ 'debug_toolbar.panels.headers.HeaderDebugPanel',
+ 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
+ 'debug_toolbar.panels.template.TemplateDebugPanel',
+ 'debug_toolbar.panels.sql.SQLDebugPanel',
+ 'debug_toolbar.panels.signals.SignalDebugPanel',
+ 'debug_toolbar.panels.logger.LoggingPanel',
+)
+DEBUG_TOOLBAR_CONFIG = {
+ 'INTERCEPT_REDIRECTS': False,
+ 'SHOW_TOOLBAR_CALLBACK': show_toolbar,
+ 'HIDE_DJANGO_SQL': True,
+}
View
4 source/templates/admin/base_site.html
@@ -1,10 +1,10 @@
{% extends "admin/base.html" %}
{% load i18n %}
-{% block title %}{{ title }} | {{ project_name|title }}{% endblock %}
+{% block title %}{{ title }} | {{ site_title|title }}{% endblock %}
{% block branding %}
-<h1 id="site-name">{{ project_name|title }}</h1>
+<h1 id="site-name">{{ site_title|title }}</h1>
{% endblock %}
{% block nav-global %}{% endblock %}
View
12 source/templatetags/verbatim.py
@@ -1,17 +1,17 @@
"""
jQuery templates use constructs like:
- {{if condition}} print something{{/if}}
+ {% templatetag openvariable %}if condition{% templatetag closevariable %} print something{% templatetag openvariable %}/if{% templatetag closevariable %}
This, of course, completely screws up Django templates,
-because Django thinks {{ and }} means something.
+because Django thinks {% templatetag openvariable %} and {% templatetag closevariable %} means something.
-Wrap {% verbatim %} and {% endverbatim %} around those
+Wrap {% templatetag openblock %} verbatim {% templatetag closeblock %} and {% templatetag openblock %} endverbatim {% templatetag closeblock %} around those
blocks of jQuery templates and this will try its best
to output the contents with no changes.
This version of verbatim template tag allows you to use tags
-like url {% url name %} or {% csrf_token %} within.
+like url {% templatetag openblock %} url name {% templatetag closeblock %} or {% templatetag openblock %} csrf_token {% templatetag closeblock %} within.
"""
from django import template
@@ -45,7 +45,7 @@ def verbatim(parser, token):
break
if token.token_type == template.TOKEN_VAR:
- text_and_nodes.append('{{')
+ text_and_nodes.append('{% templatetag openvariable %}')
text_and_nodes.append(token.contents)
elif token.token_type == template.TOKEN_TEXT:
@@ -70,6 +70,6 @@ def verbatim(parser, token):
text_and_nodes.append(node)
if token.token_type == template.TOKEN_VAR:
- text_and_nodes.append('}}')
+ text_and_nodes.append('{% templatetag closevariable %}')
return VerbatimNode(text_and_nodes)
View
2  source/urls.py
@@ -15,7 +15,7 @@
# Django Admin
(r"^%s/" % settings.ADMIN_NAMESPACE, include(admin.site.urls)),
- # Now in a template, you can access: {% url "some_namespace:url_name" %}
+ # Now in a template, you can: reverse("some_namespace:url_name")
# url(r"^name/$", inclue('app.name.urls', namespace="some_namespace")),
# url(r"^(?P<slug>[-\w]+)/$", 'some_view', name="url_name"),
)
Please sign in to comment.
Something went wrong with that request. Please try again.