Permalink
Browse files

Bug#16 - Fixing source code layout issues so new installs don't have …

…to be named patchouli
  • Loading branch information...
1 parent 3746049 commit 243333b98861597d5f419a825a9b9a6ce0f303f8 @ozten committed Aug 11, 2010
Showing with 58 additions and 32 deletions.
  1. +5 −6 README.markdown
  2. 0 { → apps}/lifestream/__init__.py
  3. 0 { → apps}/lifestream/delicious/__init__.py
  4. 0 { → apps}/lifestream/delicious/hooks.py
  5. 0 { → apps}/lifestream/flickr/__init__.py
  6. 0 { → apps}/lifestream/flickr/hooks.py
  7. 0 { → apps}/lifestream/generic/__init__.py
  8. 0 { → apps}/lifestream/generic/hooks.py
  9. 0 { → apps}/lifestream/gowalla/__init__.py
  10. 0 { → apps}/lifestream/gowalla/hooks.py
  11. 0 { → apps}/lifestream/identica/__init__.py
  12. 0 { → apps}/lifestream/identica/hooks.py
  13. 0 { → apps}/lifestream/lang.py
  14. 0 { → apps}/lifestream/models.py
  15. 0 { → apps}/lifestream/reddit/__init__.py
  16. 0 { → apps}/lifestream/reddit/hooks.py
  17. 0 { → apps}/lifestream/templatetags/__init__.py
  18. 0 { → apps}/lifestream/templatetags/common_tags.py
  19. 0 { → apps}/lifestream/twitter_com/__init__.py
  20. 0 { → apps}/lifestream/twitter_com/hooks.py
  21. 0 { → apps}/lifestream/urls.py
  22. +2 −2 { → apps}/lifestream/views.py
  23. 0 { → apps}/patchouli_auth/__init__.py
  24. 0 { → apps}/patchouli_auth/middleware/__init__.py
  25. 0 { → apps}/patchouli_auth/middleware/account_manager.py
  26. 0 { → apps}/patchouli_auth/models.py
  27. 0 { → apps}/patchouli_auth/preferences.py
  28. 0 { → apps}/patchouli_auth/templates/confirm_delete.html
  29. 0 { → apps}/patchouli_auth/templates/index.html
  30. 0 { → apps}/patchouli_auth/urls.py
  31. 0 { → apps}/patchouli_auth/views.py
  32. 0 { → apps}/streamManager/__init__.py
  33. 0 { → apps}/streamManager/models.py
  34. 0 { → apps}/streamManager/stream_config.py
  35. 0 { → apps}/streamManager/templates/404.html
  36. 0 { → apps}/streamManager/templates/500.html
  37. 0 { → apps}/streamManager/templates/all_streams.html
  38. 0 { → apps}/streamManager/templates/feed_editor.html
  39. 0 { → apps}/streamManager/templates/feed_editor_preview.html
  40. 0 { → apps}/streamManager/templates/homepage.html
  41. 0 { → apps}/streamManager/templates/stream_editor.html
  42. 0 { → apps}/streamManager/templates/template.html
  43. 0 { → apps}/streamManager/urls.py
  44. +2 −2 { → apps}/streamManager/views.py
  45. +9 −0 manage.py
  46. +2 −2 plugins/hostname_css_class.py
  47. +1 −1 plugins/social_identities.py
  48. +2 −2 plugins/stream_editor.py
  49. +13 −8 settings-dev.py
  50. +8 −7 urls.py
  51. +14 −2 wsgi/sudosocial.wsgi
View
@@ -67,7 +67,6 @@ the [zamboni](http://github.com/jbalogh/zamboni) project
as well as [Django 1.1 docs](http://docs.djangoproject.com/en/1.1/).
Those urls above have more info, but basically:
- # rename your checkout from sudosocial to patchouli (sorry, lame)
# setup a virtualenv sudosocial (optional, see link above for zamboni virtual env setup)
## workon sudosocial
# pip install -r requirements.txt
@@ -76,7 +75,6 @@ Those urls above have more info, but basically:
# update settings.py
# run python manage.py syncdb
# python manage.py runserver 0.0.0.0:8000
- # edit urls.py and update '/home/aking/patchouli/static/' to your path (sorry, lame)
# from mysql prompt, execute the migrations under docs/database/migrations/
You may need to sudo apt-get install python-lxml depending on your setup.
@@ -89,13 +87,11 @@ Again, you can find these in the VM, but:
* See requirements.txt for Python requirements.
### Patchouli ###
-Currently this repository should be named patchouli and not **`sudo`Social**.
-
What is "patchouli" in the code?
This **was** the working name of the project. This project is a small step towards **personal cloud control**.
In meatspace, *Hippies use patchouli instead of showers and deodorant*. Respect... I'm a neo-hippie, I'm just say'n.
-**`sudo`Social** is a *slightly* better name. Patches welcome :)
+**`sudo`Social** is a *slightly* better name. [Patches welcome](http://groups.google.com/group/mozilla-labs-sudosocial/browse_thread/thread/2bb964af28c46755) :)
### Lifecycle ###
Feeds are fetch and entries are pickled and stored in the database.
@@ -115,5 +111,8 @@ entry.html
### CRONs ###
#### Feed Fetcher ####
+Assuming you had this code in /home/ozten/social and a virtualenv under /home/ozten/.virtualenvs/sudosocial, you'd
+install the following cron:
+
# m h dom mon dow command
- */5 * * * * /home/ozten/.virtualenvs/patchouli/bin/python /home/ozten/patchouli/cron/feeder.py > /home/ozten/patchouli/cron/feeder.log
+ */5 * * * * /home/ozten/.virtualenvs/sudosocial/bin/python /home/username/sudosocial/cron/feeder.py > /home/username/sudosocial/cron/feeder.log
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -18,8 +18,8 @@
import lifestream.models
import patchouli_auth.preferences
-from patchouli.plugins.hostname_css_class import HostnameCssPlugin
-from patchouli.plugins.social_identities import SocialIdentityFromTagsPlugin
+from plugins.hostname_css_class import HostnameCssPlugin
+from plugins.social_identities import SocialIdentityFromTagsPlugin
logging.basicConfig(filename=settings.LOG_FILENAME, level = logging.DEBUG, format = '%(asctime)s %(levelname)s %(message)s', )
log = logging.getLogger()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -21,11 +21,11 @@
import lifestream.models
from lifestream import lang
import patchouli_auth.preferences
-from patchouli.plugins.stream_editor import StreamEditorPlugin
+from plugins.stream_editor import StreamEditorPlugin
from lifestream.views import render_entries
from lifestream.generic.hooks import tidy_up
from streamManager.stream_config import StreamConfig
-from patchouli.cron.feeder import update_feed
+from cron.feeder import update_feed
logging.basicConfig(filename=settings.LOG_FILENAME, level = logging.DEBUG, format = '%(asctime)s %(levelname)s %(message)s', )
log = logging.getLogger()
View
@@ -1,5 +1,14 @@
#!/usr/bin/env python
+import os
+import site
+import sys
+
from django.core.management import execute_manager
+
+ROOT = os.path.dirname(os.path.abspath(__file__))
+path = lambda *a: os.path.join(ROOT, *a)
+site.addsitedir(path('apps'))
+
try:
import settings # Assumed to be in the same directory.
except ImportError:
@@ -2,7 +2,7 @@
"""
import re
-from patchouli.plugins.basic import BasicPlugin
+from plugins.basic import BasicPlugin
class HostnameCssPlugin(BasicPlugin):
"""
@@ -26,4 +26,4 @@ def modify_entry_variables(self, entry, entry_variables):
entry_variables['hostname_css_class'] = cssName
return (entry, entry_variables)
-
+
@@ -3,7 +3,7 @@
This plugin looks at the tags in a stream and tries to figure
out the user's current set of social identities.
"""
-from patchouli.plugins.basic import BasicPlugin
+from plugins.basic import BasicPlugin
class SocialIdentityFromTagsPlugin(BasicPlugin): #
"""
View
@@ -4,7 +4,7 @@
from datetime import datetime
import urlparse
-from patchouli.plugins.basic import BasicPlugin
+from plugins.basic import BasicPlugin
class StreamEditorPlugin(BasicPlugin):
"""
@@ -36,4 +36,4 @@ def modify_entry_variables(self, entry, entry_variables):
def template_variables(self):
""" Callback before rendering templates, should return a Dict of
items used in templated views """
- return {'stream_editor_mode': True}
+ return {'stream_editor_mode': True}
View
@@ -1,8 +1,13 @@
import os
import os.path
-# Django settings for patchouli project.
+# Make filepaths relative to settings.
+ROOT = os.path.dirname(os.path.abspath(__file__))
+path = lambda *a: os.path.join(ROOT, *a)
+
+ROOT_PACKAGE = os.path.basename(ROOT)
+# Django settings for patchouli project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
@@ -38,12 +43,12 @@
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
-MEDIA_ROOT = ''
+MEDIA_ROOT = '%s/static/' % ROOT
# 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 = '/static/'
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
@@ -75,7 +80,7 @@
'patchouli_auth.middleware.account_manager.AccountManagerMiddleware'
)
-ROOT_URLCONF = 'patchouli.urls'
+ROOT_URLCONF = '%s.urls' % ROOT_PACKAGE
TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), 'templates')
@@ -88,9 +93,9 @@
'django.contrib.sessions',
'django.contrib.sites',
'django_openid_auth',
- 'patchouli.lifestream',
- 'patchouli.patchouli_auth',
- 'patchouli.streamManager'
+ 'lifestream',
+ 'patchouli_auth',
+ 'streamManager',
)
AUTHENTICATION_BACKENDS = (
@@ -116,4 +121,4 @@
# Cut off extermely log entries
PATCHOULI_TLDR = 8192
-LOG_FILENAME = '/tmp/django.log'
+LOG_FILENAME = '%s/django.log' % ROOT
View
15 urls.py
@@ -1,5 +1,6 @@
from django.conf.urls.defaults import *
from django.views.static import *
+from django.conf import settings
""" TODO For hosted apps, this isn't a problem
For self-hosted apps... automate checking
@@ -9,14 +10,14 @@
handler500 = 'streamManager.views.server_error'
urlpatterns = patterns('',
- (r'^.well-known/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/home/aking/patchouli/static/.well-known/'}),
- (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/home/aking/patchouli/static/'}),
- (r'^$', 'patchouli.streamManager.views.homepage', {}, 'homepage'),
- (r'^auth/', include('patchouli.patchouli_auth.urls')),
- (r'^manage/', include('patchouli.streamManager.urls')),
- (r'^u/', include('patchouli.lifestream.urls')),
+ (r'^.well-known/(?P<path>.*)$', 'django.views.static.serve', {'document_root': ('%s.well-known/' % settings.MEDIA_ROOT)}),
+ (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
+ (r'^$', 'streamManager.views.homepage', {}, 'homepage'),
+ (r'^auth/', include('patchouli_auth.urls')),
+ (r'^manage/', include('streamManager.urls')),
+ (r'^u/', include('lifestream.urls')),
#(r'^openid/logout$', 'django.contrib.auth.views.logout', {'next_page':'/openid/login'}),
# temporarily now auth
(r'^openid/', include('django_openid_auth.urls')),
- (r'^session_status$', 'patchouli.patchouli_auth.views.session_status', {}, 'session_status')
+ (r'^session_status$', 'patchouli_auth.views.session_status', {}, 'session_status')
)
View
@@ -1,9 +1,21 @@
import os
import site
-os.environ['DJANGO_SETTINGS_MODULE'] = 'patchouli.settings'
-
import django.core.handlers.wsgi
+
+# Add the parent dir to the python path so we can import manage
+wsgidir = os.path.dirname(__file__)
+site.addsitedir(os.path.abspath(os.path.join(wsgidir, '../../')))
+
+# manage.py adds the `apps` and `lib` directories to the path
+ROOT = os.path.abspath(os.path.join(wsgidir, '../'))
+ROOT_PACKAGE = os.path.basename(ROOT)
+
+os.environ['DJANGO_SETTINGS_MODULE'] = '%s.settings' % ROOT_PACKAGE
+
+__import__('%s.manage' % ROOT_PACKAGE)
+
+# for mod-wsgi
application = django.core.handlers.wsgi.WSGIHandler()
# Uncomment this to figure out what's going on with the mod_wsgi environment.

0 comments on commit 243333b

Please sign in to comment.