Skip to content

Commit

Permalink
Merge pull request #1 from klynton/master
Browse files Browse the repository at this point in the history
Upgraded to Django 1.4.2 and changed to the new project structure.
  • Loading branch information
seancribbs committed Nov 25, 2012
2 parents a2df1f1 + 6ee2882 commit d226693
Show file tree
Hide file tree
Showing 36 changed files with 32 additions and 39 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -9,7 +9,7 @@ thumbnails, image metadata, user profiles, and sessions.
The needed packages are listed in `requirements.txt`, but briefly,
they are:

* Django 1.3
* Django 1.4.2
* Python Imaging Library (PIL)
* Riak Python Client (`riak`)
* shortuuid
Expand Down
2 changes: 1 addition & 1 deletion django_riak.py
Expand Up @@ -31,7 +31,7 @@ def load(self):

def create(self):
while True:
self.session_key = self._get_new_session_key()
self._session_key = self._get_new_session_key()
try:
self.save(must_create=True)
except CreateError:
Expand Down
22 changes: 7 additions & 15 deletions manage.py
@@ -1,18 +1,10 @@
#!/usr/bin/env python
from django.core.management import execute_manager
import imp
try:
imp.find_module('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.\n"
+ "You'll have to run django-admin.py, passing it your "
+ "settings module.\n" % __file__)
sys.exit(1)

import settings
import os
import sys

if __name__ == "__main__":
execute_manager(settings)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "riagi.settings")

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
2 changes: 1 addition & 1 deletion requirements.txt
@@ -1,4 +1,4 @@
Django==1.3
Django==1.4.2
riak==1.5.1
PIL==1.1.7
shortuuid
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion images/forms.py → riagi/images/forms.py
@@ -1,5 +1,5 @@
from django import forms
from images.services import ImageService
from riagi.images.services import ImageService


class UploadForm(forms.Form):
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions images/services.py → riagi/images/services.py
Expand Up @@ -108,8 +108,8 @@ def find(self, image_id, thumb=False):
return None

def find_all(self, user):
images = self.riak.search(settings.RIAK_METADATA_BUCKET,
"user:%s" % user).map(MAP_DOCID).run()
images = self.riak.search(settings.RIAK_METADATA_BUCKET,
"user:%s" % user).map(MAP_DOCID).run()
return images

def create_unique_key(self, length=6):
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion images/urls.py → riagi/images/urls.py
@@ -1,6 +1,6 @@
from django.conf.urls.defaults import patterns, url

urlpatterns = patterns('images.views',
urlpatterns = patterns('riagi.images.views',
url(r'^upload$', 'upload'),
url(r'^(?P<image_id>[a-zA-Z0-9]{5,6})$', 'show'),
url(r'^(?P<image_id>[a-zA-Z0-9]{5,6})\.[a-z]{3}$', 'fetch'),
Expand Down
6 changes: 3 additions & 3 deletions images/views.py → riagi/images/views.py
Expand Up @@ -2,9 +2,9 @@
from django.shortcuts import render_to_response, redirect, render
from django.template import RequestContext

from images.forms import UploadForm
from images.services import ImageService, ImageError
from users.service import UserService
from riagi.images.forms import UploadForm
from riagi.images.services import ImageService, ImageError
from riagi.users.service import UserService


def upload(request):
Expand Down
9 changes: 5 additions & 4 deletions settings.py → riagi/settings.py
Expand Up @@ -4,6 +4,7 @@
import pwd
import os


# Django settings for riagi project.

if pwd.getpwuid(os.getuid())[0] == "dotcloud":
Expand All @@ -12,7 +13,7 @@
DEBUG = False
else:
RIAK_HOST = "127.0.0.1"
RIAK_PORT = "8098"
RIAK_PORT = "8087"
DEBUG = True

TEMPLATE_DEBUG = DEBUG
Expand Down Expand Up @@ -65,7 +66,7 @@
'django.contrib.messages.middleware.MessageMiddleware',
)

ROOT_URLCONF = 'urls'
ROOT_URLCONF = 'riagi.urls'

TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), "templates")
Expand All @@ -78,8 +79,8 @@
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'images',
'users'
'riagi.images',
'riagi.users'
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
Expand Down
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.
6 changes: 3 additions & 3 deletions urls.py → riagi/urls.py
Expand Up @@ -5,7 +5,7 @@
# admin.autodiscover()

urlpatterns = patterns('',
url(r'^$', 'views.home'),
url(r'^(images|i)/', include('images.urls')),
url(r'^users/', include('users.urls'))
url(r'^$', 'riagi.views.home'),
url(r'^(images|i)/', include('riagi.images.urls')),
url(r'^users/', include('riagi.users.urls'))
)
File renamed without changes.
2 changes: 1 addition & 1 deletion users/forms.py → riagi/users/forms.py
Expand Up @@ -2,7 +2,7 @@

from django import forms
from django.forms.util import ErrorList
from users.service import UserService
from riagi.users.service import UserService


class DivErrorList(ErrorList):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion users/urls.py → riagi/users/urls.py
@@ -1,6 +1,6 @@
from django.conf.urls.defaults import patterns, url

urlpatterns = patterns('users.views',
urlpatterns = patterns('riagi.users.views',
url(r'^signup$', 'signup'),
url(r'^logout$', 'logout'),
url(r'^login$', 'login'),
Expand Down
4 changes: 2 additions & 2 deletions users/views.py → riagi/users/views.py
Expand Up @@ -2,8 +2,8 @@
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext

from users.forms import SignupForm, LoginForm
from users.forms import DivErrorList
from riagi.users.forms import SignupForm, LoginForm
from riagi.users.forms import DivErrorList


def signup(request):
Expand Down
4 changes: 2 additions & 2 deletions views.py → riagi/views.py
Expand Up @@ -2,8 +2,8 @@
from django.shortcuts import render
from django.template import RequestContext

from users.service import UserService
from images.forms import UploadForm
from riagi.users.service import UserService
from riagi.images.forms import UploadForm


def home(request):
Expand Down
2 changes: 1 addition & 1 deletion wsgi.py → riagi/wsgi.py
@@ -1,6 +1,6 @@
import os

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
os.environ['DJANGO_SETTINGS_MODULE'] = 'riagi.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

0 comments on commit d226693

Please sign in to comment.