Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

complete re-org to be more pythonic

  • Loading branch information...
commit 2b3d5565b88c16084fa4dff10b85cc7402b1219e 1 parent 32fc78c
@peterbe peterbe authored
Showing with 559 additions and 260 deletions.
  1. +1 −0  .gitignore
  2. +0 −25 apps/dates/templates/pto/home.html
  3. +5 −1 manage.py
  4. 0  {apps/users/utils → pto}/__init__.py
  5. 0  {templates → pto/apps}/.gitignore
  6. 0  {apps/users/auth → pto/apps}/__init__.py
  7. 0  {apps/dates/tests → pto/apps/autocomplete}/__init__.py
  8. 0  { → pto}/apps/autocomplete/models.py
  9. +1 −1  { → pto}/apps/autocomplete/tests.py
  10. +1 −1  { → pto}/apps/autocomplete/urls.py
  11. +3 −3 { → pto}/apps/autocomplete/views.py
  12. 0  {apps/mobile → pto/apps/dates}/__init__.py
  13. 0  { → pto}/apps/dates/context_processors.py
  14. 0  { → pto}/apps/dates/csv_export.py
  15. 0  { → pto}/apps/dates/decorators.py
  16. +2 −2 { → pto}/apps/dates/forms.py
  17. 0  { → pto}/apps/dates/helpers.py
  18. 0  { → pto}/apps/dates/models.py
  19. 0  { → pto}/apps/dates/templates/dates/about-calendar-url.html
  20. 0  { → pto}/apps/dates/templates/dates/duplicate-report.html
  21. 0  { → pto}/apps/dates/templates/dates/emails_sent.html
  22. 0  { → pto}/apps/dates/templates/dates/following.html
  23. 0  { → pto}/apps/dates/templates/dates/home.html
  24. 0  { → pto}/apps/dates/templates/dates/hours.html
  25. 0  { → pto}/apps/dates/templates/dates/list.html
  26. 0  { → pto}/apps/dates/templates/dates/notification.txt
  27. 0  { → pto}/apps/dates/templates/dates/notify.html
  28. 0  {apps/autocomplete → pto/apps/dates/tests}/__init__.py
  29. +2 −2 { → pto}/apps/dates/tests/test__utils.py
  30. +9 −4 { → pto}/apps/dates/tests/test_models.py
  31. +13 −7 { → pto}/apps/dates/tests/test_views.py
  32. +1 −1  { → pto}/apps/dates/urls.py
  33. 0  { → pto}/apps/dates/utils/__init__.py
  34. 0  { → pto}/apps/dates/utils/countrytotals.py
  35. 0  { → pto}/apps/dates/utils/decorators.py
  36. 0  { → pto}/apps/dates/utils/ldap_utils.py
  37. +3 −3 { → pto}/apps/dates/views.py
  38. 0  {apps/legacy/management/commands → pto/apps/legacy}/__init__.py
  39. 0  { → pto}/apps/legacy/management/__init__.py
  40. 0  {apps/legacy → pto/apps/legacy/management/commands}/__init__.py
  41. 0  { → pto}/apps/legacy/management/commands/migrate_pto.py
  42. 0  { → pto}/apps/legacy/models.py
  43. 0  {apps/dates → pto/apps/mobile}/__init__.py
  44. 0  { → pto}/apps/mobile/helpers.py
  45. 0  { → pto}/apps/mobile/models.py
  46. 0  { → pto}/apps/mobile/templates/mobile/appcache.html
  47. 0  { → pto}/apps/mobile/templates/mobile/base.html
  48. 0  { → pto}/apps/mobile/templates/mobile/home.html
  49. 0  { → pto}/apps/mobile/templates/mobile/homeicon.html
  50. 0  { → pto}/apps/mobile/templates/mobile/mobile.html
  51. 0  { → pto}/apps/mobile/templates/mobile/page.hours.html
  52. 0  { → pto}/apps/mobile/templates/mobile/page.left.html
  53. 0  { → pto}/apps/mobile/templates/mobile/page.login.html
  54. 0  { → pto}/apps/mobile/templates/mobile/page.logout.html
  55. 0  { → pto}/apps/mobile/templates/mobile/page.notify.html
  56. 0  { → pto}/apps/mobile/templates/mobile/page.rightnow.html
  57. 0  { → pto}/apps/mobile/templates/mobile/page.settings.html
  58. 0  { → pto}/apps/mobile/templates/mobile/page.taken.html
  59. +5 −5 { → pto}/apps/mobile/tests.py
  60. 0  { → pto}/apps/mobile/urls.py
  61. +13 −13 { → pto}/apps/mobile/views.py
  62. 0  { → pto}/apps/users/__init__.py
  63. 0  { → pto}/apps/users/admin.py
  64. 0  {apps → pto/apps/users/auth}/__init__.py
  65. 0  { → pto}/apps/users/auth/backends.py
  66. 0  { → pto}/apps/users/email_auth_backend.py
  67. +1 −1  { → pto}/apps/users/forms.py
  68. 0  { → pto}/apps/users/models.py
  69. 0  { → pto}/apps/users/templates/users/login.html
  70. 0  { → pto}/apps/users/templates/users/profile.html
  71. +4 −4 { → pto}/apps/users/tests.py
  72. 0  { → pto}/apps/users/urls.py
  73. 0  { → pto/apps/users/utils}/__init__.py
  74. 0  { → pto}/apps/users/utils/ldap_lookup.py
  75. 0  { → pto}/apps/users/utils/ldap_mock.py
  76. 0  { → pto}/apps/users/views.py
  77. +1 −0  pto/base/__init__.py
  78. 0  apps/.gitignore → pto/base/models.py
  79. 0  pto/base/templates/.gitignore
  80. 0  { → pto/base}/templates/404.html
  81. 0  { → pto/base}/templates/500.html
  82. 0  { → pto/base}/templates/base.html
  83. +26 −0 pto/base/templates/example_base.html
  84. +31 −0 pto/locale/en_US/LC_MESSAGES/messages.po
  85. +29 −0 pto/locale/fr/LC_MESSAGES/messages.po
  86. +32 −0 pto/locale/templates/LC_MESSAGES/messages.pot
  87. 0  { → pto}/settings/__init__.py
  88. +49 −182 { → pto}/settings/base.py
  89. +51 −0 pto/settings/local.py
  90. 0  { → pto}/settings/local.py-dist
  91. 0  { → pto}/settings/settings_local.py-dist
  92. 0  { → pto}/settings_test.py
  93. +5 −5 { → pto}/urls.py
  94. +30 −0 puppet/files/etc/httpd/conf.d/playdoh.conf
  95. +61 −0 puppet/manifests/classes/apache.pp
  96. +3 −0  puppet/manifests/classes/custom.pp
  97. +25 −0 puppet/manifests/classes/init.pp
  98. +14 −0 puppet/manifests/classes/memcached.pp
  99. +26 −0 puppet/manifests/classes/mysql.pp
  100. +39 −0 puppet/manifests/classes/playdoh.pp
  101. +34 −0 puppet/manifests/classes/python.pp
  102. +29 −0 puppet/manifests/vagrant.pp
  103. +5 −0 vagrantconfig.yaml
  104. +5 −0 vagrantconfig_local.yaml-dist
View
1  .gitignore
@@ -20,3 +20,4 @@ settings/local*
TODO
cover/
sample_data.py
+build/
View
25 apps/dates/templates/pto/home.html
@@ -1,25 +0,0 @@
-{#
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this file,
- - You can obtain one at http://mozilla.org/MPL/2.0/.
- -->
-#}
-
-{% extends "base.html" %}
-
-{% block content %}
-<section id="pto_planner">
- <p>{{ _('Mozilla PTO Planner') }}</p>
- <form id="planner" data-url="{{ calculate_pto_url }}">
- <div><label>{{ _('Hours you have available') }}</label>
- <input name="hours_avail" id="hours_avail" type="text" value="0"></div>
- <div><label>{{ _('Hours you earn per quarter') }}</label>
- <input name="per_quarter" id="per_quarter" type="text" value="5.19"></div>
- <div><label>{{ _('Start of your trip') }}</label>
- <input class="datepicker" name="start_date" id="start_date" type="text" value=""></div>
- </form>
- <p id="result">
- {{ _('Select a start date for your trip.') }}
- </p>
-</section>
-{% endblock %}
View
6 manage.py
@@ -2,6 +2,9 @@
import os
import sys
+# Edit this if necessary or override the variable in your environment.
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pto.settings')
+
try:
# For local development in a virtualenv:
from funfactory import manage
@@ -18,7 +21,8 @@
sys.path.remove(tmp_path)
-manage.setup_environ(__file__)
+manage.setup_environ(__file__, more_pythonic=True)
if __name__ == "__main__":
+ sys.path.append(os.path.abspath('pto'))
manage.main()
View
0  apps/users/utils/__init__.py → pto/__init__.py
File renamed without changes
View
0  templates/.gitignore → pto/apps/.gitignore
File renamed without changes
View
0  apps/users/auth/__init__.py → pto/apps/__init__.py
File renamed without changes
View
0  apps/dates/tests/__init__.py → pto/apps/autocomplete/__init__.py
File renamed without changes
View
0  apps/autocomplete/models.py → pto/apps/autocomplete/models.py
File renamed without changes
View
2  apps/autocomplete/tests.py → pto/apps/autocomplete/tests.py
@@ -7,7 +7,7 @@
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.utils import simplejson as json
-from users.utils.ldap_mock import MockLDAP
+from apps.users.utils.ldap_mock import MockLDAP
from mock import Mock
from nose.tools import eq_, ok_
from test_utils import TestCase
View
2  apps/autocomplete/urls.py → pto/apps/autocomplete/urls.py
@@ -3,7 +3,7 @@
# You can obtain one at http://mozilla.org/MPL/2.0/.
from django.conf.urls.defaults import patterns, url
-import views
+from . import views
urlpatterns = patterns('',
url(r'^cities/$', views.cities, name='autocomplete.cities'),
View
6 apps/autocomplete/views.py → pto/apps/autocomplete/views.py
@@ -4,9 +4,9 @@
import logging
from django import http
-from dates.decorators import json_view
-from users.models import UserProfile, User
-from users.utils import ldap_lookup
+from apps.dates.decorators import json_view
+from apps.users.models import UserProfile, User
+from apps.users.utils import ldap_lookup
@json_view
View
0  apps/mobile/__init__.py → pto/apps/dates/__init__.py
File renamed without changes
View
0  apps/dates/context_processors.py → pto/apps/dates/context_processors.py
File renamed without changes
View
0  apps/dates/csv_export.py → pto/apps/dates/csv_export.py
File renamed without changes
View
0  apps/dates/decorators.py → pto/apps/dates/decorators.py
File renamed without changes
View
4 apps/dates/forms.py → pto/apps/dates/forms.py
@@ -8,8 +8,8 @@
from django.contrib.auth.models import User
from django.core.validators import validate_email
from django import forms
-from models import Hours, Entry
-from users.models import UserProfile
+from .models import Hours, Entry
+from apps.users.models import UserProfile
import utils
View
0  apps/dates/helpers.py → pto/apps/dates/helpers.py
File renamed without changes
View
0  apps/dates/models.py → pto/apps/dates/models.py
File renamed without changes
View
0  apps/dates/templates/dates/about-calendar-url.html → ...pps/dates/templates/dates/about-calendar-url.html
File renamed without changes
View
0  apps/dates/templates/dates/duplicate-report.html → pto/apps/dates/templates/dates/duplicate-report.html
File renamed without changes
View
0  apps/dates/templates/dates/emails_sent.html → pto/apps/dates/templates/dates/emails_sent.html
File renamed without changes
View
0  apps/dates/templates/dates/following.html → pto/apps/dates/templates/dates/following.html
File renamed without changes
View
0  apps/dates/templates/dates/home.html → pto/apps/dates/templates/dates/home.html
File renamed without changes
View
0  apps/dates/templates/dates/hours.html → pto/apps/dates/templates/dates/hours.html
File renamed without changes
View
0  apps/dates/templates/dates/list.html → pto/apps/dates/templates/dates/list.html
File renamed without changes
View
0  apps/dates/templates/dates/notification.txt → pto/apps/dates/templates/dates/notification.txt
File renamed without changes
View
0  apps/dates/templates/dates/notify.html → pto/apps/dates/templates/dates/notify.html
File renamed without changes
View
0  apps/autocomplete/__init__.py → pto/apps/dates/tests/__init__.py
File renamed without changes
View
4 apps/dates/tests/test__utils.py → pto/apps/dates/tests/test__utils.py
@@ -10,7 +10,7 @@
class TestUtils(TestCase):
def test_get_weekday_dates(self):
- from dates.utils import get_weekday_dates
+ from apps.dates.utils import get_weekday_dates
d1 = datetime.date(2018, 1, 1) # a Monday
d2 = datetime.date(2018, 1, 9) # next Tuesday
dates = list(get_weekday_dates(d1, d2))
@@ -23,7 +23,7 @@ def test_get_weekday_dates(self):
eq_(dates[6].strftime('%A'), 'Tuesday')
def test_parse_datetime(self):
- from dates.utils import parse_datetime, DatetimeParseError
+ from apps.dates.utils import parse_datetime, DatetimeParseError
eq_(parse_datetime('1285041600000').year, 2010)
eq_(parse_datetime('1283140800').year, 2010)
eq_(parse_datetime('1286744467.0').year, 2010)
View
13 apps/dates/tests/test_models.py → pto/apps/dates/tests/test_models.py
@@ -4,10 +4,15 @@
import datetime
from django.contrib.auth.models import User
-from dates.models import (Entry, Hours, BlacklistedUser, FollowingUser,
- FollowingIntegrityError,
- BlacklistIntegityError,
- UserKey)
+from apps.dates.models import (
+ Entry,
+ Hours,
+ BlacklistedUser,
+ FollowingUser,
+ FollowingIntegrityError,
+ BlacklistIntegityError,
+ UserKey
+)
from nose.tools import eq_, ok_
from test_utils import TestCase
View
20 apps/dates/tests/test_views.py → pto/apps/dates/tests/test_views.py
@@ -15,14 +15,19 @@
from django.contrib.auth.models import User
from django.utils import simplejson as json
from django.core import mail
-from dates.models import (Entry, Hours, BlacklistedUser, FollowingUser,
- UserKey)
+from apps.dates.models import (
+ Entry,
+ Hours,
+ BlacklistedUser,
+ FollowingUser,
+ UserKey
+)
from nose.tools import eq_, ok_
from test_utils import TestCase
from mock import Mock
import ldap
-from users.utils import ldap_lookup
-from users.utils.ldap_mock import MockLDAP
+from apps.users.utils import ldap_lookup
+from apps.users.utils.ldap_mock import MockLDAP
def unicode_csv_reader(unicode_csv_data,
@@ -123,6 +128,7 @@ def test_404_page(self):
ok_('Page not found' in response.content)
def test_500_page(self):
+
root_urlconf = __import__(settings.ROOT_URLCONF,
globals(), locals(), ['urls'], -1)
# ...so that we can access the 'handler500' defined in there
@@ -840,7 +846,7 @@ def test_notify_notification_attachment(self):
email = mail.outbox[-1]
def test_get_minions(self):
- from dates.views import get_minions
+ from apps.dates.views import get_minions
gary = User.objects.create_user(
'gary', 'gary@mozilla.com'
)
@@ -1527,7 +1533,7 @@ def test_adding_a_single_day_of_zero(self):
def test_get_taken_info(self):
user = User.objects.create(username='bob')
- from dates.views import get_taken_info
+ from apps.dates.views import get_taken_info
def function():
return get_taken_info(user)
@@ -2057,7 +2063,7 @@ def test_recently_created_flash_message(self):
# visit the home page and expect there to be a flash message there
response = self.client.get(reverse('dates.home'))
ok_('class="flash"' in response.content)
- from dates.views import make_entry_title
+ from apps.dates.views import make_entry_title
ok_(make_entry_title(entry, entry.user)[:10] in response.content)
# do it again
View
2  apps/dates/urls.py → pto/apps/dates/urls.py
@@ -3,7 +3,7 @@
# You can obtain one at http://mozilla.org/MPL/2.0/.
from django.conf.urls.defaults import patterns, url
-import views
+from . import views
urlpatterns = patterns('',
url(r'^$', views.home, name='dates.home'),
View
0  apps/dates/utils/__init__.py → pto/apps/dates/utils/__init__.py
File renamed without changes
View
0  apps/dates/utils/countrytotals.py → pto/apps/dates/utils/countrytotals.py
File renamed without changes
View
0  apps/dates/utils/decorators.py → pto/apps/dates/utils/decorators.py
File renamed without changes
View
0  apps/dates/utils/ldap_utils.py → pto/apps/dates/utils/ldap_utils.py
File renamed without changes
View
6 apps/dates/views.py → pto/apps/dates/views.py
@@ -25,9 +25,9 @@
from django.core.cache import cache
from django.db.models import Min, Count
import vobject
-from models import Entry, Hours, BlacklistedUser, FollowingUser, UserKey
-from users.models import UserProfile, User
-from users.utils import ldap_lookup
+from .models import Entry, Hours, BlacklistedUser, FollowingUser, UserKey
+from apps.users.models import UserProfile, User
+from apps.users.utils import ldap_lookup
from .utils import parse_datetime, DatetimeParseError
from .utils.countrytotals import UnrecognizedCountryError, get_country_totals
import utils
View
0  apps/legacy/management/commands/__init__.py → pto/apps/legacy/__init__.py
File renamed without changes
View
0  apps/legacy/management/__init__.py → pto/apps/legacy/management/__init__.py
File renamed without changes
View
0  apps/legacy/__init__.py → pto/apps/legacy/management/commands/__init__.py
File renamed without changes
View
0  apps/legacy/management/commands/migrate_pto.py → pto/apps/legacy/management/commands/migrate_pto.py
File renamed without changes
View
0  apps/legacy/models.py → pto/apps/legacy/models.py
File renamed without changes
View
0  apps/dates/__init__.py → pto/apps/mobile/__init__.py
File renamed without changes
View
0  apps/mobile/helpers.py → pto/apps/mobile/helpers.py
File renamed without changes
View
0  apps/mobile/models.py → pto/apps/mobile/models.py
File renamed without changes
View
0  apps/mobile/templates/mobile/appcache.html → pto/apps/mobile/templates/mobile/appcache.html
File renamed without changes
View
0  apps/mobile/templates/mobile/base.html → pto/apps/mobile/templates/mobile/base.html
File renamed without changes
View
0  apps/mobile/templates/mobile/home.html → pto/apps/mobile/templates/mobile/home.html
File renamed without changes
View
0  apps/mobile/templates/mobile/homeicon.html → pto/apps/mobile/templates/mobile/homeicon.html
File renamed without changes
View
0  apps/mobile/templates/mobile/mobile.html → pto/apps/mobile/templates/mobile/mobile.html
File renamed without changes
View
0  apps/mobile/templates/mobile/page.hours.html → pto/apps/mobile/templates/mobile/page.hours.html
File renamed without changes
View
0  apps/mobile/templates/mobile/page.left.html → pto/apps/mobile/templates/mobile/page.left.html
File renamed without changes
View
0  apps/mobile/templates/mobile/page.login.html → pto/apps/mobile/templates/mobile/page.login.html
File renamed without changes
View
0  apps/mobile/templates/mobile/page.logout.html → pto/apps/mobile/templates/mobile/page.logout.html
File renamed without changes
View
0  apps/mobile/templates/mobile/page.notify.html → pto/apps/mobile/templates/mobile/page.notify.html
File renamed without changes
View
0  apps/mobile/templates/mobile/page.rightnow.html → pto/apps/mobile/templates/mobile/page.rightnow.html
File renamed without changes
View
0  apps/mobile/templates/mobile/page.settings.html → pto/apps/mobile/templates/mobile/page.settings.html
File renamed without changes
View
0  apps/mobile/templates/mobile/page.taken.html → pto/apps/mobile/templates/mobile/page.taken.html
File renamed without changes
View
10 apps/mobile/tests.py → pto/apps/mobile/tests.py
@@ -10,8 +10,8 @@
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.utils import simplejson as json
-from dates.tests.test_views import ViewsTestMixin
-from dates.models import Entry, Hours
+from apps.dates.tests.test_views import ViewsTestMixin
+from apps.dates.models import Entry, Hours
from test_utils import TestCase
@@ -177,7 +177,7 @@ def test_taken_json(self):
response = self.client.get(url)
struct = json.loads(response.content)
- from dates.views import get_taken_info
+ from apps.dates.views import get_taken_info
eq_(struct, get_taken_info(user))
def test_notify(self):
@@ -415,7 +415,7 @@ def test_save_settings(self):
struct = json.loads(response.content)
ok_(struct['ok'])
- from users.models import UserProfile
+ from apps.users.models import UserProfile
profile = UserProfile.objects.get(user__username='peter')
eq_(profile.country, 'GB')
eq_(profile.city, 'London')
@@ -446,7 +446,7 @@ def test_save_settings_security_hack(self):
struct = json.loads(response.content)
ok_(struct['ok'])
- from users.models import UserProfile
+ from apps.users.models import UserProfile
profile = UserProfile.objects.get(user__username='peter')
eq_(profile.country, 'GB')
eq_(profile.city, 'London')
View
0  apps/mobile/urls.py → pto/apps/mobile/urls.py
File renamed without changes
View
26 apps/mobile/views.py → pto/apps/mobile/views.py
@@ -11,10 +11,10 @@
from django.conf import settings
from django.shortcuts import redirect, get_object_or_404, render
from django.contrib.auth import login as auth_login, logout as auth_logout
-from dates.models import Entry, Hours
-from dates.decorators import json_view
-from dates.utils import get_weekday_dates
-from users.forms import ProfileForm
+from apps.dates.models import Entry, Hours
+from apps.dates.decorators import json_view
+from apps.dates.utils import get_weekday_dates
+from apps.users.forms import ProfileForm
MOBILE_DATE_FORMAT = '%Y-%m-%d'
@@ -40,8 +40,8 @@ def appcache(request):
def right_now(request):
if not request.user.is_authenticated(): # XXX improve this
return {'error': 'Not logged in'}
- from dates.views import get_right_nows, get_upcomings
- from dates.helpers import format_date
+ from apps.dates.views import get_right_nows, get_upcomings
+ from apps.dates.helpers import format_date
right_nows, right_now_users = get_right_nows()
upcomings, upcoming_users = get_upcomings(14)
@@ -94,7 +94,7 @@ def right_now(request):
def taken(request):
if not request.user.is_authenticated(): # XXX improve this
return {'error': 'Not logged in'}
- from dates.views import get_taken_info
+ from apps.dates.views import get_taken_info
return get_taken_info(request.user)
@@ -105,8 +105,8 @@ def taken(request):
def notify(request):
if not request.user.is_authenticated(): # XXX improve this
return {'error': 'Not logged in'}
- from dates.forms import AddForm
- from dates.views import clean_unfinished_entries
+ from apps.dates.forms import AddForm
+ from apps.dates.views import clean_unfinished_entries
form = AddForm(request.user, data=request.POST)
if form.is_valid():
start = form.cleaned_data['start']
@@ -143,8 +143,8 @@ def save_hours(request):
if entry.user != request.user:
return http.HttpResponseForbidden("Not your entry")
- from dates.forms import HoursForm
- from dates.views import save_entry_hours, send_email_notification
+ from apps.dates.forms import HoursForm
+ from apps.dates.views import save_entry_hours, send_email_notification
form = HoursForm(entry, data=request.POST)
if form.is_valid():
total_hours, is_edit = save_entry_hours(entry, form)
@@ -199,7 +199,7 @@ def settings_json(request):
'username': request.user.username,
'email': request.user.email,
}
- from dates.helpers import full_name_form
+ from apps.dates.helpers import full_name_form
data['full_name'] = full_name_form(None, request.user)
profile = request.user.get_profile()
if profile.start_date:
@@ -244,7 +244,7 @@ def login(request):
if request.method == 'GET':
return {'logged_in': request.user.is_authenticated()}
- from users.forms import AuthenticationForm
+ from apps.users.forms import AuthenticationForm
form = AuthenticationForm(data=request.POST)
if form.is_valid():
auth_login(request, form.get_user())
View
0  apps/users/__init__.py → pto/apps/users/__init__.py
File renamed without changes
View
0  apps/users/admin.py → pto/apps/users/admin.py
File renamed without changes
View
0  apps/__init__.py → pto/apps/users/auth/__init__.py
File renamed without changes
View
0  apps/users/auth/backends.py → pto/apps/users/auth/backends.py
File renamed without changes
View
0  apps/users/email_auth_backend.py → pto/apps/users/email_auth_backend.py
File renamed without changes
View
2  apps/users/forms.py → pto/apps/users/forms.py
@@ -5,7 +5,7 @@
from django import forms
import django.contrib.auth.forms
from .models import UserProfile
-from dates.forms import BaseModelForm
+from apps.dates.forms import BaseModelForm
from lib.country_aliases import ALIASES as COUNTRY_ALIASES
View
0  apps/users/models.py → pto/apps/users/models.py
File renamed without changes
View
0  apps/users/templates/users/login.html → pto/apps/users/templates/users/login.html
File renamed without changes
View
0  apps/users/templates/users/profile.html → pto/apps/users/templates/users/profile.html
File renamed without changes
View
8 apps/users/tests.py → pto/apps/users/tests.py
@@ -14,10 +14,10 @@
from mock import Mock
import ldap
-from users.auth.backends import MozillaLDAPBackend
-from users.utils.ldap_mock import MockLDAP
-from users.models import UserProfile
-from users.utils import ldap_lookup
+from apps.users.auth.backends import MozillaLDAPBackend
+from apps.users.utils.ldap_mock import MockLDAP
+from apps.users.models import UserProfile
+from apps.users.utils import ldap_lookup
RaiseInvalidCredentials = object()
View
0  apps/users/urls.py → pto/apps/users/urls.py
File renamed without changes
View
0  __init__.py → pto/apps/users/utils/__init__.py
File renamed without changes
View
0  apps/users/utils/ldap_lookup.py → pto/apps/users/utils/ldap_lookup.py
File renamed without changes
View
0  apps/users/utils/ldap_mock.py → pto/apps/users/utils/ldap_mock.py
File renamed without changes
View
0  apps/users/views.py → pto/apps/users/views.py
File renamed without changes
View
1  pto/base/__init__.py
@@ -0,0 +1 @@
+"""Application base, containing global templates."""
View
0  apps/.gitignore → pto/base/models.py
File renamed without changes
View
0  pto/base/templates/.gitignore
No changes.
View
0  templates/404.html → pto/base/templates/404.html
File renamed without changes
View
0  templates/500.html → pto/base/templates/500.html
File renamed without changes
View
0  templates/base.html → pto/base/templates/base.html
File renamed without changes
View
26 pto/base/templates/example_base.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html LANG="{{ LANG }}" dir="{{ DIR }}">
+ <head>
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+ <title>{% block page_title %}playdoh examples{% endblock %}</title>
+
+ {% block site_css %}
+ {{ css('example_css') }}
+ {% endblock %}
+ </head>
+ <body data-mobile-cookie="{{ settings.MOBILE_COOKIE }}">
+ {% block content %}{% endblock %}
+
+ <div id="footer">
+ {# These links will add/remove cookies. See JavaScript. #}
+ <a class="desktop-link" href="">{{ _('View Desktop Site') }}</a>
+ &nbsp;|&nbsp;
+ <a class="mobile-link" href="">{{ _('View Mobile Site') }}</a>
+ </div>
+
+ {% block site_js %}
+ {{ js('example_js') }}
+ {% endblock %}
+ </body>
+</html>
+
View
31 pto/locale/en_US/LC_MESSAGES/messages.po
@@ -0,0 +1,31 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-05-26 18:11-0700\n"
+"PO-Revision-Date: 2011-05-26 18:11-0700\n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: en_US\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Translate Toolkit 1.8.0\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: apps/examples/templates/examples/home.html:5
+msgid "Hello world"
+msgstr "Hello world"
+
+#. This is a localizer comment
+#: apps/examples/templates/examples/home.html:9
+msgid "This is a <em>test view</em>."
+msgstr "This is a <em>test view</em>."
+
+#: apps/examples/templates/examples/home.html:11
+msgid "<a href=\"%(docs_url)s\">Learn you some Playdoh</a> and then go build something <strong>awesome</strong>."
+msgstr "<a href=\"%(docs_url)s\">Learn you some Playdoh</a> and then go build something <strong>awesome</strong>."
+
+#: apps/examples/templates/examples/home.html:17
+msgid "Current locale: %(LANG)s.<br> Available locales: %(langs)s."
+msgstr "Current locale: %(LANG)s.<br> Available locales: %(langs)s."
View
29 pto/locale/fr/LC_MESSAGES/messages.po
@@ -0,0 +1,29 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-06-03 19:07-0700\n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: fr\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+#: apps/examples/templates/examples/home.html:5
+msgid "Hello world"
+msgstr "Bonjour le monde"
+
+#. This is a localizer comment
+#: apps/examples/templates/examples/home.html:9
+msgid "This is a <em>test view</em>."
+msgstr "Ceci est une <em>vue de test</em>."
+
+#: apps/examples/templates/examples/home.html:11
+msgid "<a href=\"%(docs_url)s\">Learn you some Playdoh</a> and then go build something <strong>awesome</strong>."
+msgstr "<a href=\"%(docs_url)s\">Apprends à jouer avec Playdoh</a> et construis quelque chose de <strong>génial</strong>."
+
+#: apps/examples/templates/examples/home.html:17
+msgid "Current locale: %(LANG)s.<br> Available locales: %(langs)s."
+msgstr "Langue active&nbsp;: %(LANG)s.<br> Langues disponibles&nbsp;: %(langs)s."
View
32 pto/locale/templates/LC_MESSAGES/messages.pot
@@ -0,0 +1,32 @@
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-06-03 19:07-0700\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Translate Toolkit 1.8.0\n"
+
+#: apps/examples/templates/examples/home.html:5
+msgid "Hello world"
+msgstr ""
+
+#. This is a localizer comment
+#: apps/examples/templates/examples/home.html:9
+msgid "This is a <em>test view</em>."
+msgstr ""
+
+#: apps/examples/templates/examples/home.html:11
+msgid ""
+"<a href=\"%(docs_url)s\">Learn you some Playdoh</a> and then go build "
+"something <strong>awesome</strong>."
+msgstr ""
+
+#: apps/examples/templates/examples/home.html:17
+msgid "Current locale: %(LANG)s.<br> Available locales: %(langs)s."
+msgstr ""
View
0  settings/__init__.py → pto/settings/__init__.py
File renamed without changes
View
231 settings/base.py → pto/settings/base.py
@@ -1,153 +1,13 @@
-# Django settings file for a project based on the playdoh template.
+# This is your project's main settings file that can be committed to your
+# repo. If you need to override a setting locally, use settings_local.py
from funfactory.settings_base import *
-import os
-
-
-# Make file paths relative to settings.
-#ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
-#path = lambda *a: os.path.join(ROOT, *a)
-
-#ROOT_PACKAGE = os.path.basename(ROOT)
-
-# Is this a dev instance?
-#DEV = False
-
-#DEBUG = False
-#TEMPLATE_DEBUG = DEBUG
-
-#ADMINS = ()
-#MANAGERS = ADMINS
-
-DATABASES = {} # See settings/local.py
-
-# Site ID is used by Django's Sites framework.
-SITE_ID = 1
-
-
-## Internationalization.
-
-# Local time zone for this installation. Choices can be found here:
-# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
-# although not all choices may be available on all operating systems.
-# On Unix systems, a value of None will cause Django to use the same
-# timezone as the operating system.
-# If running in a Windows environment this must be set to the same as your
-# system time zone.
-TIME_ZONE = 'America/Los_Angeles'
-
-# If you set this to False, Django will make some optimizations so as not
-# to load the internationalization machinery.
-USE_I18N = False
-
-# If you set this to False, Django will not format dates, numbers and
-# calendars according to the current locale
-USE_L10N = True
-
-# The host currently running the site. Only use this in code for good reason;
-# the site is designed to run on a cluster and should continue to support that
-#HOSTNAME = socket.gethostname()
-
-# The front end domain of the site. If you're not running on a cluster this
-# might be the same as HOSTNAME but don't depend on that. Use this when you
-# need the real domain.
-#DOMAIN = HOSTNAME
-
-# Full base URL for your main site including protocol. No trailing slash.
-# Example: https://example.com
-#SITE_URL = 'http://%s' % DOMAIN
-
-# paths for images, e.g. mozcdn.com/amo or '/static'
-#STATIC_URL = SITE_URL
-
-# Gettext text domain
-#TEXT_DOMAIN = 'messages'
-#STANDALONE_DOMAINS = [TEXT_DOMAIN, 'javascript']
-#TOWER_KEYWORDS = {'_lazy': None}
-#TOWER_ADD_HEADERS = True
-
-# Language code for this installation. All choices can be found here:
-# http://www.i18nguy.com/unicode/language-identifiers.html
-#LANGUAGE_CODE = 'en-US'
-
-## Accepted locales
-
-# On dev instances, the list of accepted locales defaults to the contents of
-# the `locale` directory. A localizer can add their locale in the l10n
-# repository (copy of which is checked out into `locale`) in order to start
-# testing the localization on the dev server.
-#try:
-# DEV_LANGUAGES = [
-# loc.replace('_', '-') for loc in os.listdir(path('locale'))
-# if os.path.isdir(path('locale', loc)) and loc != 'templates'
-# ]
-#except OSError:
-# DEV_LANGUAGES = ('en-US',)
-
-# On stage/prod, the list of accepted locales is manually maintained. Only
-# locales whose localizers have signed off on their work should be listed here.
-#PROD_LANGUAGES = (
-# 'en-US',
-#)
-
-#def lazy_lang_url_map():
-# from django.conf import settings
-# langs = settings.DEV_LANGUAGES if settings.DEV else settings.PROD_LANGUAGES
-# return dict([(i.lower(), i) for i in langs])
-
-#LANGUAGE_URL_MAP = lazy(lazy_lang_url_map, dict)()
-
-## Override Django's built-in with our native names
-#def lazy_langs():
-# from django.conf import settings
-# from product_details import product_details
-# langs = DEV_LANGUAGES if settings.DEV else PROD_LANGUAGES
-# return dict([(lang.lower(), product_details.languages[lang]['native'])
-# for lang in langs])
-
-# Where to store product details etc.
-#PROD_DETAILS_DIR = path('lib/product_details_json')
-
-#LANGUAGES = lazy(lazy_langs, dict)()
-
-# Paths that don't require a locale code in the URL.
-#SUPPORTED_NONLOCALES = ['media']
-
-
-## Media and templates.
-
-# Absolute path to the directory that holds media.
-# Example: "/home/media/media.lawrence.com/"
-#MEDIA_ROOT = path('media')
-
-# URL that handles the media served from MEDIA_ROOT. Make sure to use a
-# trailing slash if there is a path component (optional in other cases).
-# Examples: "http://media.lawrence.com", "http://example.com/media/"
-#MEDIA_URL = '/media/'
-
-# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
-# trailing slash.
-# Examples: "http://foo.com/media/", "/media/".
-#ADMIN_MEDIA_PREFIX = '/admin-media/'
-
-# Make this unique, and don't share it with anybody.
-SECRET_KEY = 'override this with something secret and unique'
-
-TEMPLATE_CONTEXT_PROCESSORS += (
- 'dates.context_processors.global_settings',
- 'jingo_minify.helpers.build_ids',
-)
-
-TEMPLATE_DIRS = (
- path('templates'),
-)
-
-JINGO_EXCLUDE_APPS = (
- # XXX need to figure out which of these is the right setting
-# 'django.contrib.admin',
-# 'admin',
-)
+# Name of the top-level module where you put all your apps.
+# If you did not install Playdoh with the funfactory installer script
+# you may need to edit this value. See the docs about installing from a
+# clone.
+PROJECT_MODULE = 'pto'
# Bundles is a dictionary of two dictionaries, css and js, which list css files
# and js files that can be bundled together by the minify app.
@@ -229,6 +89,38 @@
}
}
+## Internationalization.
+
+# Local time zone for this installation. Choices can be found here:
+# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
+# although not all choices may be available on all operating systems.
+# On Unix systems, a value of None will cause Django to use the same
+# timezone as the operating system.
+# If running in a Windows environment this must be set to the same as your
+# system time zone.
+TIME_ZONE = 'America/Los_Angeles'
+
+# If you set this to False, Django will make some optimizations so as not
+# to load the internationalization machinery.
+USE_I18N = False
+
+# If you set this to False, Django will not format dates, numbers and
+# calendars according to the current locale
+USE_L10N = True
+
+# Make this unique, and don't share it with anybody.
+SECRET_KEY = '' # override this in local.py
+
+TEMPLATE_CONTEXT_PROCESSORS += (
+ 'apps.dates.context_processors.global_settings',
+ 'jingo_minify.helpers.build_ids',
+)
+
+
+JINGO_EXCLUDE_APPS = (
+ 'admin',
+)
+
## Middlewares, apps, URL configs.
MIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES)
@@ -238,47 +130,23 @@
MIDDLEWARE_CLASSES.append('mobility.middleware.XMobileMiddleware')
MIDDLEWARE_CLASSES = tuple(MIDDLEWARE_CLASSES)
-# XXX need to change to "new-style" funfactory project some time soon
-root_package = os.path.basename(ROOT)
-ROOT_URLCONF = '%s.urls' % root_package
+ROOT_URLCONF = '%s.urls' % PROJECT_MODULE
INSTALLED_APPS += (
- # Local apps
- #'commons', # Content common to most playdoh-based apps.
- #'jingo_minify',
- #'tower', # for ./manage.py extract (L10n)
-
- # We need this so the jsi18n view will pick up our locale directory.
- #ROOT_PACKAGE,
-
- # Third-party apps
- #'commonware.response.cookies',
- #'djcelery',
- #'django_nose',
'mobility',
-
- # Django contrib apps
- #'django.contrib.auth',
- #'django_sha2', # Load after auth to monkey-patch it.
-
- #'django.contrib.contenttypes',
- #'django.contrib.sessions',
- # 'django.contrib.sites',
'django.contrib.messages',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
- # L10n
- #'product_details',
-
# apps/
- 'dates',
- 'users',
- 'legacy',
- 'mobile',
- 'autocomplete',
+ 'base',
+ 'apps.dates',
+ 'apps.users',
+ 'apps.legacy',
+ 'apps.mobile',
+ 'apps.autocomplete',
)
# Path to Java. Used for compress_assets.
@@ -319,8 +187,7 @@
#CELERY_IGNORE_RESULT = True
# Logging
-LOG_LEVEL = logging.INFO
-SYSLOG_TAG = "pto"
+LOGGING = dict(loggers=dict(playdoh={'level': logging.DEBUG}))
AUTH_PROFILE_MODULE = 'users.UserProfile'
@@ -355,8 +222,8 @@
import ldap
AUTHENTICATION_BACKENDS = (
- 'users.email_auth_backend.EmailOrUsernameModelBackend',
- 'users.auth.backends.MozillaLDAPBackend',
+ 'apps.users.email_auth_backend.EmailOrUsernameModelBackend',
+ 'apps.users.auth.backends.MozillaLDAPBackend',
'django.contrib.auth.backends.ModelBackend',
)
View
51 pto/settings/local.py
@@ -0,0 +1,51 @@
+# Is this a development instance? Set this to True on development/master
+# instances and False on stage/prod.
+
+
+#from . import base
+#INSTALLED_APPS = base.INSTALLED_APPS + ('debug_toolbar',)
+#MIDDLEWARE_CLASSES = base.MIDDLEWARE_CLASSES + ('debug_toolbar.middleware.DebugToolbarMiddleware',)
+#INTERNAL_IPS = ('127.0.0.1',)
+DEBUG_PROPAGATE_EXCEPTIONS = True
+DEV = DEBUG = TEMPLATE_DEBUG = True
+TEMPLATE_STRING_IF_INVALID = '!{ %s }'
+EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
+PWD_ALGORITHM = 'sha521'
+SESSION_COOKIE_SECURE = False # if you run http://localhost:8000
+
+
+#TEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner'
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.mysql',
+ 'NAME': 'pto',
+ 'USER': 'root',
+ 'PASSWORD': 'test123',
+ 'HOST': '',
+ 'PORT': '3306',
+ 'OPTIONS': {
+ 'init_command': 'SET storage_engine=InnoDB',
+ 'charset' : 'utf8',
+ 'use_unicode' : True,
+ },
+ 'TEST_CHARSET': 'utf8',
+ 'TEST_COLLATION': 'utf8_general_ci',
+ },
+}
+
+
+#AUTH_LDAP_HOST = 'ldap://pm-ns.mozilla.org'
+AUTH_LDAP_SERVER_URI = 'ldap://pm-ns.mozilla.org'
+AUTH_LDAP_BIND_DN = 'uid=bind-pto,ou=logins,dc=mozilla'
+AUTH_LDAP_BIND_PASSWORD = 'yg50MAjJqYDMS3Liny'
+AUTH_LDAP_START_TLS = False
+
+#import ldap
+#AUTH_LDAP_GLOBAL_OPTIONS = {
+# ldap.OPT_DEBUG_LEVEL: 4095
+#}
+
+#AUTH_LDAP_SERVER_URI = 'ldap://pm-ns.mozilla.org'
+#AUTH_LDAP_BIND_DN = 'uid=binduser,ou=logins,dc=mozilla'
+#AUTH_LDAP_BIND_PASSWORD = 'Z6bp3Zrh'
View
0  settings/local.py-dist → pto/settings/local.py-dist
File renamed without changes
View
0  settings/settings_local.py-dist → pto/settings/settings_local.py-dist
File renamed without changes
View
0  settings_test.py → pto/settings_test.py
File renamed without changes
View
10 urls.py → pto/urls.py
@@ -7,13 +7,13 @@
from funfactory.monkeypatches import patch
patch()
-handler500 = 'dates.views.handler500'
+handler500 = 'apps.dates.views.handler500'
urlpatterns = patterns('',
- (r'^users/', include('users.urls')),
- (r'^mobile/', include('mobile.urls')),
- (r'^autocomplete/', include('autocomplete.urls')),
- (r'', include('dates.urls')),
+ (r'^users/', include('apps.users.urls')),
+ (r'^mobile/', include('apps.mobile.urls')),
+ (r'^autocomplete/', include('apps.autocomplete.urls')),
+ (r'', include('apps.dates.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
View
30 puppet/files/etc/httpd/conf.d/playdoh.conf
@@ -0,0 +1,30 @@
+# HACK: Make the server reload after every hit to refresh django code
+MaxRequestsPerChild 1
+
+WSGISocketPrefix /var/run/wsgi
+
+<VirtualHost *:443 *:80>
+ ServerName dev.playdoh.org
+
+ DirectoryIndex index.php index.html
+ Options -Indexes
+
+ RewriteEngine On
+
+ DocumentRoot "/var/www/html/"
+
+ Alias /media/ "/home/vagrant/project/media/"
+ Alias /admin-media/ "/home/vagrant/project/vendor/src/django/django/contrib/admin/media/"
+
+ WSGIDaemonProcess playdoh processes=1 threads=1 maximum-requests=1
+ WSGIProcessGroup playdoh
+
+ WSGIScriptAlias / "/home/vagrant/project/wsgi/playdoh.wsgi"
+
+ <Proxy *>
+ AddDefaultCharset off
+ Order deny,allow
+ Deny from all
+ Allow from all
+ </Proxy>
+</VirtualHost>
View
61 puppet/manifests/classes/apache.pp
@@ -0,0 +1,61 @@
+# Red Hat, CentOS, and Fedora think Apache is the only web server
+# ever, so we have to use a different package on CentOS than Ubuntu.
+class apache {
+ case $operatingsystem {
+ centos: {
+ package { "httpd-devel":
+ ensure => present,
+ before => File['/etc/httpd/conf.d/playdoh.conf'];
+ }
+
+ file { "/etc/httpd/conf.d/playdoh.conf":
+ source => "$PROJ_DIR/puppet/files/etc/httpd/conf.d/playdoh.conf",
+ owner => "root", group => "root", mode => 0644,
+ require => [
+ Package['httpd-devel']
+ ];
+ }
+
+ service { "httpd":
+ ensure => running,
+ enable => true,
+ require => [
+ Package['httpd-devel'],
+ File['/etc/httpd/conf.d/playdoh.conf']
+ ];
+ }
+
+ }
+ ubuntu: {
+ package { "apache2-dev":
+ ensure => present,
+ before => File['/etc/apache2/sites-enabled/playdoh.conf'];
+ }
+
+ file { "/etc/apache2/sites-enabled/playdoh.conf":
+ source => "$PROJ_DIR/puppet/files/etc/httpd/conf.d/playdoh.conf",
+ owner => "root", group => "root", mode => 0644,
+ require => [
+ Package['apache2-dev']
+ ];
+ }
+
+ exec {
+ 'a2enmod rewrite':
+ onlyif => 'test ! -e /etc/apache2/mods-enabled/rewrite.load';
+ 'a2enmod proxy':
+ onlyif => 'test ! -e /etc/apache2/mods-enabled/proxy.load';
+ }
+
+ service { "apache2":
+ ensure => running,
+ enable => true,
+ require => [
+ Package['apache2-dev'],
+ File['/etc/apache2/sites-enabled/playdoh.conf']
+ ];
+ }
+
+ }
+ }
+}
View
3  puppet/manifests/classes/custom.pp
@@ -0,0 +1,3 @@
+# You can add custom puppet manifests for your app here.
+class custom {
+}
View
25 puppet/manifests/classes/init.pp
@@ -0,0 +1,25 @@
+# stage {"pre": before => Stage["main"]} class {'apt': stage => 'pre'}
+
+# Commands to run before all others in puppet.
+class init {
+ group { "puppet":
+ ensure => "present",
+ }
+
+ case $operatingsystem {
+ ubuntu: {
+ exec { "update_apt":
+ command => "sudo apt-get update",
+ }
+
+ # Provides "add-apt-repository" command, useful if you need
+ # to install software from other apt repositories.
+ package { "python-software-properties":
+ ensure => present,
+ require => [
+ Exec['update_apt'],
+ ];
+ }
+ }
+ }
+}
View
14 puppet/manifests/classes/memcached.pp
@@ -0,0 +1,14 @@
+# We use memcached in production, so we _should_ use it while
+# we develop as well. That said, playdoh shouldn't *rely* on it
+# entirely; it should work with any non-null cache store in Django.
+class memcached {
+ package { "memcached":
+ ensure => installed;
+ }
+
+ service { "memcached":
+ ensure => running,
+ enable => true,
+ require => Package['memcached'];
+ }
+}
View
26 puppet/manifests/classes/mysql.pp
@@ -0,0 +1,26 @@
+# Get mysql up and running
+class mysql {
+ package { "mysql-server":
+ ensure => installed;
+ }
+
+ case $operatingsystem {
+ centos: {
+ package { "mysql-devel":
+ ensure => installed;
+ }
+ }
+
+ ubuntu: {
+ package { "libmysqld-dev":
+ ensure => installed;
+ }
+ }
+ }
+
+ service { "mysql":
+ ensure => running,
+ enable => true,
+ require => Package['mysql-server'];
+ }
+}
View
39 puppet/manifests/classes/playdoh.pp
@@ -0,0 +1,39 @@
+# playdoh-specific commands that get playdoh all going so you don't
+# have to.
+
+# TODO: Make this rely on things that are not straight-up exec.
+class playdoh {
+ file { "$PROJ_DIR/project/settings/local.py":
+ ensure => file,
+ source => "$PROJ_DIR/project/settings/local.py-dist",
+ replace => false;
+ }
+
+ exec { "create_mysql_database":
+ command => "mysql -uroot -B -e'CREATE DATABASE $DB_NAME CHARACTER SET utf8;'",
+ unless => "mysql -uroot -B --skip-column-names -e 'show databases' | /bin/grep '$DB_NAME'",
+ require => File["$PROJ_DIR/project/settings/local.py"]
+ }
+
+ exec { "grant_mysql_database":
+ command => "mysql -uroot -B -e'GRANT ALL PRIVILEGES ON $DB_NAME.* TO $DB_USER@localhost # IDENTIFIED BY \"$DB_PASS\"'",
+ unless => "mysql -uroot -B --skip-column-names mysql -e 'select user from user' | grep '$DB_USER'",
+ require => Exec["create_mysql_database"];
+ }
+
+ exec { "syncdb":
+ cwd => "$PROJ_DIR",
+ command => "python ./manage.py syncdb --noinput",
+ require => Exec["grant_mysql_database"];
+ }
+
+ exec { "sql_migrate":
+ cwd => "$PROJ_DIR",
+ command => "python ./vendor/src/schematic/schematic migrations/",
+ require => [
+ Service["mysql"],
+ Package["python2.6-dev", "libapache2-mod-wsgi", "python-wsgi-intercept" ],
+ Exec["syncdb"]
+ ];
+ }
+}
View
34 puppet/manifests/classes/python.pp
@@ -0,0 +1,34 @@
+# Install python and compiled modules for project
+class python {
+ case $operatingsystem {
+ centos: {
+ package {
+ ["python26-devel", "python26-libs", "python26-distribute", "python26-mod_wsgi"]:
+ ensure => installed;
+ }
+
+ exec { "pip-install":
+ command => "easy_install -U pip",
+ creates => "pip",
+ require => Package["python26-devel", "python26-distribute"]
+ }
+
+ exec { "pip-install-compiled":
+ command => "pip install -r $PROJ_DIR/requirements/compiled.txt",
+ require => Exec['pip-install']
+ }
+ }
+
+ ubuntu: {
+ package {
+ ["python2.6-dev", "python2.6", "libapache2-mod-wsgi", "python-wsgi-intercept", "python-pip"]:
+ ensure => installed;
+ }
+
+ exec { "pip-install-compiled":
+ command => "pip install -r $PROJ_DIR/requirements/compiled.txt",
+ require => Package['python-pip']
+ }
+ }
+ }
+}
View
29 puppet/manifests/vagrant.pp
@@ -0,0 +1,29 @@
+#
+# Playdoh puppet magic for dev boxes
+#
+import "classes/*.pp"
+
+$PROJ_DIR = "/home/vagrant/project"
+
+# You can make these less generic if you like, but these are box-specific
+# so it's not required.
+$DB_NAME = "playdoh_app"
+$DB_USER = "root"
+
+Exec {
+ path => "/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin",
+}
+
+class dev {
+ class {
+ init: before => Class[mysql];
+ mysql: before => Class[python];
+ python: before => Class[apache];
+ apache: before => Class[playdoh];
+ memcached: ;
+ playdoh: ;
+ custom: ;
+ }
+}
+
+include dev
View
5 vagrantconfig.yaml
@@ -0,0 +1,5 @@
+# Default config for Vagrant
+
+# Don't change this; use vagrantconfig_local.yaml to override these
+# settings instead.
+nfs: false
View
5 vagrantconfig_local.yaml-dist
@@ -0,0 +1,5 @@
+# Configuration for Vagrant
+
+# Change to true if you can use nfs; using nfs significantly
+# improves performance.
+nfs: false
Please sign in to comment.
Something went wrong with that request. Please try again.