-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Fergal Walsh
authored and
Fergal Walsh
committed
Oct 30, 2013
0 parents
commit a774a07
Showing
7 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
*.pyc | ||
.DS_Store | ||
MANIFEST | ||
|
||
dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
1. `pip install django-pico` | ||
|
||
|
||
2. Add "djpico" to your INSTALLED_APPS setting like this: | ||
``` | ||
INSTALLED_APPS = ( | ||
... | ||
'djpico', | ||
) | ||
``` | ||
|
||
|
||
3. Include the polls URLconf in your project urls.py like this:: | ||
|
||
`url(r'^pico/', include('djpico.urls')),` | ||
|
||
|
||
|
||
See [Pico](https://github.com/fergalwalsh/pico/) for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
""" | ||
django-pico is a wrapper for the pico web application framework. | ||
Copyright (c) 2013, Fergal Walsh. | ||
License: BSD | ||
""" | ||
|
||
__author__ = 'Fergal Walsh' | ||
__version__ = '0.0.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.conf.urls import patterns, url | ||
|
||
urlpatterns = patterns( | ||
'', | ||
url(r'pico.js|client.js', 'djpico.views.picojs', name='picojs'), | ||
url(r'^.*$', 'djpico.views.index', name='index'), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import pico.server | ||
from django.http import HttpResponse | ||
from django.views.decorators.csrf import csrf_exempt | ||
|
||
|
||
@csrf_exempt | ||
def index(request): | ||
params = {} | ||
params.update(request.GET.dict()) | ||
params.update(request.POST.dict()) | ||
path = '/' + request.path.split('/pico/')[-1] | ||
pico_response = pico.server.handle_api_v2(path, params) | ||
response = HttpResponse(pico_response.output) | ||
for key, header in pico_response.headers: | ||
response[key] = header | ||
return response | ||
|
||
|
||
def picojs(request): | ||
f = open(pico.server.pico_path + 'client.js') | ||
return HttpResponse(f.read(), mimetype='application/javascript') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import os | ||
from setuptools import setup | ||
|
||
import djpico | ||
|
||
README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read() | ||
|
||
# allow setup.py to be run from any path | ||
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) | ||
|
||
version = djpico.__version__ | ||
|
||
setup( | ||
name='django-pico', | ||
version='0.0.1', | ||
packages=['djpico'], | ||
install_requires=['pico >= 1.2.1', 'django'], | ||
include_package_data=True, | ||
license='BSD License', | ||
description='A Django wrapper for the Pico web app framework', | ||
long_description=README, | ||
url='http://github.com/fergalwalsh/django-pico', | ||
download_url='https://github.com/fergalwalsh/django-pico/tarball/%s' % version, | ||
author='Fergal Walsh', | ||
author_email='[email protected]', | ||
classifiers=[ | ||
'Environment :: Web Environment', | ||
'Framework :: Django', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: BSD License', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 2', | ||
'Programming Language :: Python :: 2.7', | ||
'Topic :: Internet :: WWW/HTTP', | ||
'Topic :: Internet :: WWW/HTTP :: Dynamic Content', | ||
], | ||
) |