Skip to content

Commit

Permalink
example local_settings file
Browse files Browse the repository at this point in the history
  • Loading branch information
jessykate committed Nov 13, 2010
1 parent 92c102d commit 235eeb1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion frontend/urls.py
@@ -1,6 +1,6 @@
from django.conf.urls.defaults import patterns, url
from django.views.generic.simple import direct_to_template
from wordapi.frontend.views import *
from frontend.views import *

urlpatterns = patterns('',
url(r'^learn', direct_to_template, {'template': 'frontend/learn.html'}),
Expand Down
12 changes: 6 additions & 6 deletions frontend/views.py
Expand Up @@ -30,7 +30,7 @@ def new_document(request):
if request.method == 'GET':
form = TagCloudForm()
return render_to_formtemplate(request, 'frontend/newdoc.html',
{'domain': settings.ROOT_URL,'tagcloud_form' : form })
{'domain': settings.API_URL,'tagcloud_form' : form })

else:
form = TagCloudForm(request.POST, request.FILES)
Expand All @@ -45,22 +45,22 @@ def new_document(request):
args[field] = value

if 'file' in args:
url = settings.ROOT_URL + "/api/1.0/tagcloud/file.json"
url = settings.API_URL + "/api/1.0/tagcloud/file.json"
fp = request.FILES['file']
tmp_file = ''
for chunk in fp.chunks():
tmp_file += chunk
args['file'] = tmp_file

elif 'body' in args:
url = settings.ROOT_URL + "/api/1.0/tagcloud/body.json"
url = settings.API_URL + "/api/1.0/tagcloud/body.json"
# normalize the character encoding on any input text
args['body'] = args['body'].encode('ascii', 'replace')

elif 'freqs' in args:
url = settings.ROOT_URL + "/api/1.0/tagcloud/freq.json"
url = settings.API_URL + "/api/1.0/tagcloud/freq.json"
else: # this is a 'url' call
url = settings.ROOT_URL + "/api/1.0/tagcloud/url.json"
url = settings.API_URL + "/api/1.0/tagcloud/url.json"

headers = {'Content-type': 'application/x-www-form-urlencoded',
'enctype': 'enctype="multipart/form-data"'}
Expand Down Expand Up @@ -103,7 +103,7 @@ def new_document(request):
print 'Form did not validate'
form = TagCloudForm(request.POST)
return render_to_formtemplate(request, 'frontend/newdoc.html',
{'domain': settings.ROOT_URL,
{'domain': settings.API_URL,
'tagcloud_form' : form
})

Expand Down
6 changes: 6 additions & 0 deletions local_settings.py.example
@@ -0,0 +1,6 @@
API_URL = "http://localhost:8712"
HOME_PAGE = "http://localhost:9999"

# for creating tinyurls for tag clouds
BITLY_USER = "your bitly username"
BITLY_KEY = "your bitly key"
2 changes: 1 addition & 1 deletion urls.py
Expand Up @@ -10,7 +10,7 @@
# (r'^wordfrontend/', include('wordfrontend.foo.urls')),
url(r'^%s/(?P<path>.*)$' % settings.MEDIA_URL.strip('/'),
'django.views.static.serve', {'document_root': settings.MEDIA_ROOT }),
(r'^api/1.0/', include('wordapi.api.urls')),
(r'^api/1.0/', include('api.urls')),
(r'^', include('frontend.urls')),

# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
Expand Down

0 comments on commit 235eeb1

Please sign in to comment.