Revision 37ff2e2c
b/.gitignore | ||
---|---|---|
1 |
settings.py |
|
2 |
*.db |
|
3 |
*.pyc |
|
4 |
.DS_Store |
b/src/api/models.py | ||
---|---|---|
1 |
from django.db import models |
|
2 |
|
|
3 |
# Create your models here. |
b/src/api/tests.py | ||
---|---|---|
1 |
""" |
|
2 |
This file demonstrates two different styles of tests (one doctest and one |
|
3 |
unittest). These will both pass when you run "manage.py test". |
|
4 |
|
|
5 |
Replace these with more appropriate tests for your application. |
|
6 |
""" |
|
7 |
|
|
8 |
from django.test import TestCase |
|
9 |
|
|
10 |
class SimpleTest(TestCase): |
|
11 |
def test_basic_addition(self): |
|
12 |
""" |
|
13 |
Tests that 1 + 1 always equals 2. |
|
14 |
""" |
|
15 |
self.failUnlessEqual(1 + 1, 2) |
|
16 |
|
|
17 |
__test__ = {"doctest": """ |
|
18 |
Another way to test that 1 + 1 is equal to 2. |
|
19 |
|
|
20 |
>>> 1 + 1 == 2 |
|
21 |
True |
|
22 |
"""} |
|
23 |
|
b/src/api/views.py | ||
---|---|---|
1 |
# Create your views here. |
b/src/backends/dummy.py | ||
---|---|---|
1 |
|
|
2 |
def create_container(name): |
|
3 |
return |
|
4 |
|
|
5 |
def delete_container(name): |
|
6 |
return |
|
7 |
|
|
8 |
def get_container_meta(name): |
|
9 |
return {'name': name, 'count': 0, 'bytes': 0} |
|
10 |
|
|
11 |
def list_containers(): |
|
12 |
return [] |
|
13 |
|
|
14 |
def list_objects(container, prefix='', delimiter='/'): |
|
15 |
return [] |
|
16 |
|
|
17 |
def get_object_meta(container, name): |
|
18 |
return {'name': name, 'hash': '', 'bytes': 0} |
|
19 |
|
|
20 |
def get_object_data(container, name, offset=0, length=0): |
|
21 |
return '' |
|
22 |
|
|
23 |
def update_object(container, name, meta, data): |
|
24 |
return |
|
25 |
|
|
26 |
def update_object_meta(container, name, meta): |
|
27 |
return |
|
28 |
|
|
29 |
def copy_object(container, name, new_name): |
|
30 |
return |
|
31 |
|
|
32 |
def delete_object(container, name): |
|
33 |
return |
b/src/manage.py | ||
---|---|---|
1 |
#!/usr/bin/env python |
|
2 |
from django.core.management import execute_manager |
|
3 |
try: |
|
4 |
import settings # Assumed to be in the same directory. |
|
5 |
except ImportError: |
|
6 |
import sys |
|
7 |
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__) |
|
8 |
sys.exit(1) |
|
9 |
|
|
10 |
if __name__ == "__main__": |
|
11 |
execute_manager(settings) |
b/src/settings.py.dist | ||
---|---|---|
1 |
# Django settings for pithos project. |
|
2 |
|
|
3 |
DEBUG = True |
|
4 |
TEMPLATE_DEBUG = DEBUG |
|
5 |
|
|
6 |
ADMINS = ( |
|
7 |
# ('Your Name', 'your_email@domain.com'), |
|
8 |
) |
|
9 |
|
|
10 |
MANAGERS = ADMINS |
|
11 |
|
|
12 |
DATABASES = { |
|
13 |
'default': { |
|
14 |
'ENGINE': 'sqlite3', |
|
15 |
'NAME': 'pithos.db', |
|
16 |
} |
|
17 |
} |
|
18 |
|
|
19 |
# Local time zone for this installation. Choices can be found here: |
|
20 |
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name |
|
21 |
# although not all choices may be available on all operating systems. |
|
22 |
# On Unix systems, a value of None will cause Django to use the same |
|
23 |
# timezone as the operating system. |
|
24 |
# If running in a Windows environment this must be set to the same as your |
|
25 |
# system time zone. |
|
26 |
TIME_ZONE = 'UTC' |
|
27 |
|
|
28 |
# Language code for this installation. All choices can be found here: |
|
29 |
# http://www.i18nguy.com/unicode/language-identifiers.html |
|
30 |
LANGUAGE_CODE = 'en-us' |
|
31 |
|
|
32 |
SITE_ID = 1 |
|
33 |
|
|
34 |
# If you set this to False, Django will make some optimizations so as not |
|
35 |
# to load the internationalization machinery. |
|
36 |
USE_I18N = True |
|
37 |
|
|
38 |
# If you set this to False, Django will not format dates, numbers and |
|
39 |
# calendars according to the current locale |
|
40 |
USE_L10N = True |
|
41 |
|
|
42 |
# Absolute filesystem path to the directory that will hold user-uploaded files. |
|
43 |
# Example: "/home/media/media.lawrence.com/" |
|
44 |
MEDIA_ROOT = '' |
|
45 |
|
|
46 |
# URL that handles the media served from MEDIA_ROOT. Make sure to use a |
|
47 |
# trailing slash if there is a path component (optional in other cases). |
|
48 |
# Examples: "http://media.lawrence.com", "http://example.com/media/" |
|
49 |
MEDIA_URL = '' |
|
50 |
|
|
51 |
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a |
|
52 |
# trailing slash. |
|
53 |
# Examples: "http://foo.com/media/", "/media/". |
|
54 |
ADMIN_MEDIA_PREFIX = '/media/' |
|
55 |
|
|
56 |
# Make this unique, and don't share it with anybody. |
|
57 |
SECRET_KEY = '$^b#b-a1wyqr^liu+0gwmo2nypm#(mv@&==w&ryn&cd9=50sci' |
|
58 |
|
|
59 |
# List of callables that know how to import templates from various sources. |
|
60 |
TEMPLATE_LOADERS = ( |
|
61 |
'django.template.loaders.filesystem.Loader', |
|
62 |
'django.template.loaders.app_directories.Loader', |
|
63 |
# 'django.template.loaders.eggs.Loader', |
|
64 |
) |
|
65 |
|
|
66 |
MIDDLEWARE_CLASSES = ( |
|
67 |
'django.middleware.common.CommonMiddleware', |
|
68 |
'django.contrib.sessions.middleware.SessionMiddleware', |
|
69 |
'django.middleware.csrf.CsrfViewMiddleware', |
|
70 |
'django.contrib.auth.middleware.AuthenticationMiddleware', |
|
71 |
'django.contrib.messages.middleware.MessageMiddleware', |
|
72 |
) |
|
73 |
|
|
74 |
ROOT_URLCONF = 'pithos.urls' |
|
75 |
|
|
76 |
TEMPLATE_DIRS = ( |
|
77 |
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". |
|
78 |
# Always use forward slashes, even on Windows. |
|
79 |
# Don't forget to use absolute paths, not relative paths. |
|
80 |
) |
|
81 |
|
|
82 |
INSTALLED_APPS = ( |
|
83 |
'django.contrib.auth', |
|
84 |
'django.contrib.contenttypes', |
|
85 |
'django.contrib.sessions', |
|
86 |
'django.contrib.sites', |
|
87 |
'django.contrib.messages', |
|
88 |
'django.contrib.admin', |
|
89 |
'django.contrib.admindocs', |
|
90 |
'api', |
|
91 |
) |
b/src/urls.py | ||
---|---|---|
1 |
from django.conf.urls.defaults import * |
|
2 |
|
|
3 |
# Uncomment the next two lines to enable the admin: |
|
4 |
# from django.contrib import admin |
|
5 |
# admin.autodiscover() |
|
6 |
|
|
7 |
urlpatterns = patterns('', |
|
8 |
# Example: |
|
9 |
# (r'^pithos/', include('pithos.foo.urls')), |
|
10 |
|
|
11 |
# Uncomment the admin/doc line below to enable admin documentation: |
|
12 |
# (r'^admin/doc/', include('django.contrib.admindocs.urls')), |
|
13 |
|
|
14 |
# Uncomment the next line to enable the admin: |
|
15 |
# (r'^admin/', include(admin.site.urls)), |
|
16 |
) |
Also available in: Unified diff