Permalink
Browse files

Let the fun begin

  • Loading branch information...
0 parents commit 40dbdb04fb7c86b4b66934ff43d41f1c9de8e1f4 @kumar303 kumar303 committed Jul 15, 2011
@@ -0,0 +1,4 @@
+*.py[co]
+*.sw[po]
+.DS_Store
+.nose*
25 LICENSE
@@ -0,0 +1,25 @@
+Copyright (c) 2011, Mozilla
+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 of the copyright owner 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 HOLDER 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.
@@ -0,0 +1,4 @@
+funfactory is the what makes `playdoh`_ fun. You import it within a Django `manage.py`_ file but the playdoh docs will explain everything.
+
+.. _`playdoh`: https://github.com/mozilla/playdoh
+.. _`manage.py`: https://github.com/mozilla/playdoh/blob/base/manage.py
No changes.
@@ -0,0 +1,104 @@
+#!/usr/bin/env python
+import logging
+import os
+import site
+import sys
+
+
+current_settings = None
+execute_manager = None
+log = logging.getLogger(__name__)
+ROOT = None
+
+
+def path(*a):
+ return os.path.join(ROOT, *a)
+
+
+def setup_environ(manage_file, settings=None):
+ """Sets up a Django app within a manage.py file.
+
+ Keyword Arguments
+
+ **settings**
+ An imported settings module. Without this, playdoh tries to import
+ these modules (in order): settings_local, settings
+
+ """
+ # sys is global to avoid undefined local
+ global sys, current_settings, execute_manager, ROOT
+
+ ROOT = os.path.dirname(os.path.abspath(manage_file))
+
+ # Adjust the python path and put local packages in front.
+ prev_sys_path = list(sys.path)
+
+ # Make settings_local importable
+ sys.path.append(os.getcwd())
+
+ site.addsitedir(path('apps'))
+ site.addsitedir(path('lib'))
+
+ # Local (project) vendor library
+ site.addsitedir(path('vendor-local'))
+ site.addsitedir(path('vendor-local/lib/python'))
+
+ # Global (upstream) vendor library
+ site.addsitedir(path('vendor'))
+ site.addsitedir(path('vendor/lib/python'))
+
+ # Move the new items to the front of sys.path. (via virtualenv)
+ new_sys_path = []
+ for item in list(sys.path):
+ if item not in prev_sys_path:
+ new_sys_path.append(item)
+ sys.path.remove(item)
+ sys.path[:0] = new_sys_path
+
+ from django.core.management import execute_manager, setup_environ
+
+ exceptions = []
+ if not settings:
+ try:
+ import settings_local as settings
+ except ImportError, exc:
+ exceptions.append(('settings_local', exc))
+ try:
+ import settings
+ except ImportError:
+ exceptions.append(('settings', exc))
+ import sys
+ import traceback
+ traceback.print_exc()
+ sys.stderr.write(
+ "\nError: Tried importing 'settings_local.py' and "
+ "'settings.py' but neither could be found (or they're "
+ "throwing an ImportError)."
+ " This is what we tried to do:\n\n")
+ for mod, exc in exceptions:
+ sys.stderr.write("import %s\n" % mod)
+ sys.stderr.write(" %s: %s\n" % (exc.__class__.__name__,
+ exc))
+ sys.exit(1)
+ current_settings = settings
+
+ # If we want to use django settings anywhere, we need to set up the
+ # required environment variables.
+ setup_environ(settings)
+
+ # Monkey-patch django forms to avoid having to use Jinja2's |safe
+ # everywhere.
+ import safe_django_forms
+ safe_django_forms.monkeypatch()
+
+ # Configure Celery (optional)
+ try:
+ import djcelery
+ except ImportError, exc:
+ log.warning('%s (playdoh did not initialize djcelery)' % exc)
+ else:
+ djcelery.setup_loader()
+
+
+def main():
+ execute_manager(current_settings)
@@ -0,0 +1 @@
+# This is here to trick Django
@@ -0,0 +1,7 @@
+MySQL-python==1.2.3c1
+Jinja2==2.5.5
+
+# for bcrypt passwords
+hmac==20101005
+hashlib==20081119
+py-bcrypt==0.2
@@ -0,0 +1,16 @@
+# This file pulls in everything a developer needs. If it's a basic package
+# needed to run the site, it belongs in requirements/prod.txt. If it's a
+# package for developers (testing, docs, etc.), it goes in this file.
+
+-r prod.txt
+
+# Documentation
+Sphinx==1.0.6
+
+# Testing
+nose==1.0.0
+-e git://github.com/jbalogh/django-nose.git#egg=django_nose
+-e git://github.com/jbalogh/test-utils.git#egg=test-utils
+
+# L10n
+translate-toolkit==1.8.0
@@ -0,0 +1,24 @@
+# Django stuff
+-e git://github.com/django/django@36c82ac8#egg=django
+
+# Templates
+-e git://github.com/jbalogh/jingo.git#egg=jingo
+-e git://github.com/jsocol/jingo-minify.git#egg=jingo-minify
+GitPython==0.1.7
+
+# Various tidbits
+-e git://github.com/jsocol/commonware.git#egg=commonware
+-e git://github.com/mozilla/nuggets.git#egg=nuggets
+
+# Security
+-e git://github.com/fwenzel/django-sha2.git#egg=django-sha2
+-e git://github.com/jsocol/bleach.git#egg=bleach
+
+# Celery: Message queue
+celery
+django-celery
+
+# L10n
+Babel>=0.9.4
+-e git://github.com/clouserw/tower.git#egg=tower
+-e git://github.com/fwenzel/django-mozilla-product-details#egg=django-mozilla-product-details
Oops, something went wrong.

0 comments on commit 40dbdb0

Please sign in to comment.