Permalink
Browse files

initial move to github and updates towards 0.2 release

  • Loading branch information...
1 parent af45002 commit 1de67fa56d359405eff46ed43aadb8fc555a1f23 @howiworkdaily howiworkdaily committed Aug 20, 2009
Showing with 7,672 additions and 0 deletions.
  1. +5 −0 .gitignore
  2. +25 −0 LICENSE
  3. +33 −0 README
  4. +14 −0 mingus/__init__.py
  5. 0 mingus/core/__init__.py
  6. +33 −0 mingus/core/context_processors.py
  7. +20 −0 mingus/core/middleware.py
  8. +120 −0 mingus/core/views.py
  9. +1 −0 mingus/initial_data.json
  10. +51 −0 mingus/local_settings.py.template
  11. +17 −0 mingus/manage.py
  12. +401 −0 mingus/media/static/css/960.css
  13. +220 −0 mingus/media/static/css/base.css
  14. +53 −0 mingus/media/static/css/reset.css
  15. +29 −0 mingus/media/static/css/themes/basic.css
  16. +36 −0 mingus/media/static/css/themes/dark.css
  17. +36 −0 mingus/media/static/css/themes/django.css
  18. +36 −0 mingus/media/static/css/themes/jeffcroft.css
  19. +26 −0 mingus/media/static/css/themes/minimal.css
  20. BIN mingus/media/static/imgs/bg_trans.png
  21. +14 −0 mingus/media/static/js/DD_belatedPNG_0.0.7a-min.js
  22. +51 −0 mingus/media/static/prettyify/lang-apollo.js
  23. +78 −0 mingus/media/static/prettyify/lang-css.js
  24. +101 −0 mingus/media/static/prettyify/lang-hs.js
  25. +93 −0 mingus/media/static/prettyify/lang-lisp.js
  26. +59 −0 mingus/media/static/prettyify/lang-lua.js
  27. +56 −0 mingus/media/static/prettyify/lang-ml.js
  28. +35 −0 mingus/media/static/prettyify/lang-proto.js
  29. +57 −0 mingus/media/static/prettyify/lang-sql.js
  30. +61 −0 mingus/media/static/prettyify/lang-vb.js
  31. +53 −0 mingus/media/static/prettyify/lang-wiki.js
  32. +27 −0 mingus/media/static/prettyify/prettify.css
  33. +1,425 −0 mingus/media/static/prettyify/prettify.js
  34. +3,365 −0 mingus/pip-log.txt
  35. +27 −0 mingus/requirements.txt
  36. +92 −0 mingus/settings.py
  37. +130 −0 mingus/templates/404.html
  38. +130 −0 mingus/templates/500.html
  39. +19 −0 mingus/templates/admin/base_site.html
  40. +35 −0 mingus/templates/admin/login.html
  41. +162 −0 mingus/templates/base.html
  42. +2 −0 mingus/templates/blog/base_blog.html
  43. +20 −0 mingus/templates/blog/category_detail.html
  44. +8 −0 mingus/templates/blog/includes/_comments.html
  45. +12 −0 mingus/templates/blog/includes/_pagination.html
  46. +13 −0 mingus/templates/blog/includes/_post_detail.html
  47. +7 −0 mingus/templates/blog/includes/_post_list.html
  48. +62 −0 mingus/templates/blog/post_detail.html
  49. +25 −0 mingus/templates/blog/post_search.html
  50. +19 −0 mingus/templates/blog/tag_detail.html
  51. +43 −0 mingus/templates/contact_form/contact_form.html
  52. +9 −0 mingus/templates/contact_form/contact_form.txt
  53. +19 −0 mingus/templates/contact_form/contact_form_sent.html
  54. +1 −0 mingus/templates/contact_form/contact_form_subject.txt
  55. +1 −0 mingus/templates/feeds/categories_description.html
  56. +1 −0 mingus/templates/feeds/categories_title.html
  57. +1 −0 mingus/templates/feeds/latest_description.html
  58. +1 −0 mingus/templates/feeds/latest_title.html
  59. +2 −0 mingus/templates/feeds/posts_description.html
  60. +1 −0 mingus/templates/feeds/posts_title.html
  61. +1 −0 mingus/templates/flatblocks/bare.html
  62. +15 −0 mingus/templates/flatpages/default.html
  63. +8 −0 mingus/templates/inlines/media_photo.html
  64. +1 −0 mingus/templates/oembed/link.html
  65. +27 −0 mingus/templates/people/quote_detail.html
  66. +10 −0 mingus/templates/proxy/includes/_bookmark_item.html
  67. +13 −0 mingus/templates/proxy/includes/_post_item.html
  68. +11 −0 mingus/templates/proxy/includes/_quote_item.html
  69. +27 −0 mingus/templates/proxy/proxy_list.html
  70. +74 −0 mingus/urls.py
  71. +12 −0 setup.py
View
@@ -0,0 +1,5 @@
+*.pyc
+*.bak
+*.db
+local_settings.py
+
View
25 LICENSE
@@ -0,0 +1,25 @@
+Copyright (c) 2009, Monty Lounge Industries, LLC <kevin@montylounge.com>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name django-mingus nor the names of its contributors
+ may be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
33 README
@@ -0,0 +1,33 @@
+
+A Django blog engine leveraging only existing reusable apps, and django-snippets. The project itself defines no models (db schemas).
+
+More details to come soon, tutorials, etc. There are some hidden "features" (ex. api support for Django-springsteen out of the box meaning easy plugin to findjango.com, and some others stuff the community has provided.)
+
+*This was an initial project for a Django-NYC presentation, thrown together with some concepts for a personal blog engine I've had in notes laying around..
+
+Quickstart (VirtualENV/PIP Version)
+------------------------------------
+
+> mkvirtualenv myblog
+> easy_install pip
+> hg clone https://montylounge@bitbucket.org/montylounge/django-mingus/
+#I do the next two steps below because I'm not familiar enough with HG to retrieve a subdir of a repository
+> mv django-mingus/mingus .
+> rm -rf django-mingus
+> cd mingus
+> pip install -r requirements
+... wait a bit
+> mv local_settings.py.template local_settings.py
+> ./manage.py syncdb
+> ./manage.py runserver
+
+By default the theme is set to the Basic theme.
+
+Django-Mingus also comes with 4 additional themes: Django(green), Minimal (black/white), Dark (black), Basic (beige/red), JeffCroft (brown/pink)
+
+To switch "themes" just change this line in templates/base.html:
+
+<link rel="stylesheet" href="{{ STATIC_URL }}css/themes/basic.css" type="text/css" media="all" charset="utf-8">
+
+You'll notice the themes/basic.css text - change that to one of the existing themes, or edit away on your own!
+
View
@@ -0,0 +1,14 @@
+from django.db.models import signals
+from django_proxy.signals import proxy_save, proxy_delete
+from basic.blog.models import Post
+from basic.people.models import Quote
+from basic.bookmarks.models import Bookmark
+
+signals.post_save.connect(proxy_save, Post, True)
+signals.post_delete.connect(proxy_delete, Post)
+
+signals.post_save.connect(proxy_save, Quote, True)
+signals.post_delete.connect(proxy_delete, Quote)
+
+signals.post_save.connect(proxy_save, Bookmark, True)
+signals.post_delete.connect(proxy_delete, Bookmark)
View
No changes.
@@ -0,0 +1,33 @@
+from django.conf import settings
+from basic.blog.models import Category
+from django.core.cache import cache
+from basic.blog.models import Settings
+from basic.elsewhere.models import SocialNetworkProfile
+
+def site_info(request):
+ """
+ Adds site-specific meta information to the context.
+
+ To employ, add the site_info method reference to your project
+ settings TEMPLATE_CONTEXT_PROCESSORS.
+
+ Example:
+ TEMPLATE_CONTEXT_PROCESSORS = (
+ ...
+ "mingus.core.context_processors.site_info",
+ )
+ """
+
+ site_id = settings.SITE_ID
+ key = 'basic.blog.settings:%s' % site_id
+ blog_settings = cache.get(key, None)
+ if blog_settings is None:
+ blog_settings = Settings.get_current()
+ cache.set(key, blog_settings)
+
+ STATIC_URL = getattr(settings,'STATIC_URL', '')
+
+ return {
+ 'BLOG_SETTINGS': blog_settings,
+ 'STATIC_URL': STATIC_URL,
+ }
View
@@ -0,0 +1,20 @@
+from django.conf import settings
+from django.http import *
+from django.views.debug import technical_500_response
+import sys
+
+class UserBasedExceptionMiddleware(object):
+ '''
+ Displays Django debugging messaage based on active user's session.
+
+ Requirement:
+ Active user's' session must be an authenticated superuser, or make sure active
+ user's IP address is in INTERNAL_IPs for the error message to display. Otherwise
+ user will receive the configured server response, which is normally a "friendly"
+ 500 server error page.
+
+ Source: http://ericholscher.com/blog/2008/nov/15/debugging-django-production-environments/
+ '''
+ def process_exception(self, request, exception):
+ if request.user.is_superuser or request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS:
+ return technical_500_response(request, *sys.exc_info())
View
@@ -0,0 +1,120 @@
+from django.utils import simplejson
+from django.http import HttpResponse
+from django.shortcuts import get_object_or_404
+from basic.blog.models import Post, Category
+from django.conf import settings
+from django import http
+from django.template import loader, Context
+from django_proxy.models import Proxy
+from django.views.generic import list_detail
+from django.core.cache import cache
+from basic.blog.models import Settings
+from view_cache_utils import cache_page_with_prefix
+from contact_form.views import contact_form as django_contact_form
+from contact_form.forms import ContactForm
+from honeypot.decorators import check_honeypot
+
+def page_key_prefix(request):
+ return request.GET.get('page','')
+
+def post_result_item(post):
+ '''Generates the item result object for django-springsteen integration.'''
+ return {
+ 'title': post.title,
+ 'url': settings.SITE_URL + post.get_absolute_url(),
+ 'text': post.body,
+ }
+
+def springsteen_results(request):
+ '''
+ Creates the django-springsteen compliant JSON results for only for findjango
+ integration.
+
+ Results:
+ Published Post objects.
+ '''
+
+ results = [ post_result_item(item) for item in Post.objects.published()[:50] ]
+ response_dict = { 'total_results': Post.objects.published().count(), 'results': results, }
+ return HttpResponse(simplejson.dumps(response_dict), mimetype='application/javascript')
+
+
+def server_error(request, template_name='500.html'):
+ '''Handles displaying 500 server error page along with application MEDIA.'''
+
+ t = loader.get_template(template_name)
+ return http.HttpResponseServerError(t.render(Context({
+ "MEDIA_URL": settings.MEDIA_URL,
+ "STATIC_URL": settings.STATIC_URL,
+ })))
+
+
+def springsteen_firehose(request):
+ '''Generates django-springsteen compliant JSON results of proxy models for findjango integration.'''
+
+ def result_item(proxy):
+ '''Generates the item result object.'''
+
+ if proxy.content_type.name == 'bookmark':
+ url = proxy.content_object.get_absolute_url()
+ else:
+ url = settings.SITE_URL + proxy.content_object.get_absolute_url()
+
+ return {
+ 'title': proxy.title,
+ 'url': url,
+ 'text': proxy.description,
+ }
+
+ posts = Proxy.objects.published()[:50].order_by('-pub_date')
+ results = [ result_item(item) for item in posts ]
+ response_dict = { 'total_results': Proxy.objects.published().count(), 'results': results, }
+ return HttpResponse(simplejson.dumps(response_dict), mimetype='application/javascript')
+
+def springsteen_category(request, slug):
+ '''
+ Creates the django-springsteen compliant JSON results for only for findjango
+ integration.
+
+ Results:
+ Published Post objects by category.
+ '''
+
+ category = get_object_or_404(Category, slug__iexact=slug)
+ posts = category.post_set.published()[:50]
+ results = [ post_result_item(item) for item in posts ]
+ response_dict = { 'total_results': category.post_set.published().count(), 'results': results, }
+ return HttpResponse(simplejson.dumps(response_dict), mimetype='application/javascript')
+
+
+@cache_page_with_prefix(60, page_key_prefix)
+def home_list(request, page=0, template_name='proxy/proxy_list.html', **kwargs):
+ '''
+ Homepage.
+
+ Template: ``proxy/proxy_list.html``
+ Context:
+ object_list
+ Aggregated list of Proxy instances (post, quote, bookmark).
+
+ '''
+
+ posts = Proxy.objects.published().order_by('-pub_date')
+ pagesize = Settings.get_current().page_size or 20
+
+ return list_detail.object_list(
+ request,
+ queryset = posts,
+ paginate_by = pagesize,
+ page = page,
+ template_name = template_name,
+ **kwargs
+ )
+
+
+@check_honeypot
+def contact_form(request, form_class=ContactForm,
+ template_name='contact_form/contact_form.html'):
+
+ return django_contact_form(request, form_class=form_class,
+ template_name=template_name)
View
@@ -0,0 +1 @@
+[{"pk": 1, "model": "navbar.navbarentry", "fields": {"name": "about", "parent": null, "title": "about", "url": "/about/", "user_type": "E", "groups": [], "path_type": "A", "order": 0}}, {"pk": 2, "model": "flatblocks.flatblock", "fields": {"content": "Powered by <a href=\"http://bitbucket.org/montylounge/django-mingus/\" title=\"Mingus blog engine\">Mingus</a> a <a href=\"http://djangoproject.com\" title=\"Django - web framework for perfectionists with deadlines.\">Django</a> project. You're enjoying the Basic theme.", "header": "", "slug": "footer"}}, {"pk": 1, "model": "flatpages.flatpage", "fields": {"registration_required": false, "title": "About", "url": "/about/", "template_name": "", "sites": [1], "content": "<p>\r\nA little about yourself.\r\n</p>", "enable_comments": false}}, {"pk": 1, "model": "blog.post", "fields": {"body": "<p>\r\nWelcome to django-mingus, the Django powered blog engine.\r\n</p>", "status": 2, "allow_comments": true, "author": null, "tease": "Hey there world.", "modified": "2009-07-01 23:22:04", "publish": "2009-07-01 23:19:39", "created": "2009-07-01 23:20:29", "categories": [1], "title": "Welcome", "slug": "welcome", "tags": "blog, mingus"}}, {"pk": 1, "model": "blog.category", "fields": {"slug": "django", "title": "Django"}}]
@@ -0,0 +1,51 @@
+
+LOCAL_DEV = True
+DEBUG = True
+TEMPLATE_DEBUG = DEBUG
+#sorl-thumbnail
+THUMBNAIL_DEBUG = True
+
+DEFAULT_FROM_EMAIL = 'contactform@foo'
+
+MANAGERS = (
+ ('fooper','fooper@foo'),
+)
+
+DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+DATABASE_NAME = 'dev.db' # Or path to database file if using sqlite3.
+DATABASE_USER = '' # Not used with sqlite3.
+DATABASE_PASSWORD = '' # Not used with sqlite3.
+DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
+DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
+
+EMAIL_HOST = 'smtp.gmail.com'
+EMAIL_PORT = 587
+EMAIL_HOST_USER = 'ABC'
+EMAIL_HOST_PASSWORD = 'ABC'
+EMAIL_USE_TLS = True
+
+CACHE_BACKEND = 'locmem:///'
+
+CACHE_MIDDLEWARE_SECONDS = 60*5
+CACHE_MIDDLEWARE_KEY_PREFIX = 'mingus.'
+CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
+
+##### DEBUG-TOOLBAR SETTINGS ########
+DEBUG_TOOLBAR_CONFIG = {
+'INTERCEPT_REDIRECTS': False,
+}
+
+INTERNAL_IPS = ('127.0.0.1',)
+
+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.panels.cache.CachePanel',
+)
View
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+
+import os
+import sys
+
+from os.path import abspath, dirname, join
+from django.core.management import execute_manager
+try:
+ import settings # Assumed to be in the same directory.
+except ImportError:
+ import sys
+ sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
+ sys.exit(1)
+
+if __name__ == "__main__":
+ execute_manager(settings)
+
Oops, something went wrong.

0 comments on commit 1de67fa

Please sign in to comment.