Skip to content

Commit a774a07

Browse files
Fergal WalshFergal Walsh
Fergal Walsh
authored and
Fergal Walsh
committed
Initial commit
0 parents  commit a774a07

File tree

7 files changed

+102
-0
lines changed

7 files changed

+102
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
*.pyc
3+
.DS_Store
4+
MANIFEST
5+
6+
dist/*

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include README.md

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
1. `pip install django-pico`
3+
4+
5+
2. Add "djpico" to your INSTALLED_APPS setting like this:
6+
```
7+
INSTALLED_APPS = (
8+
...
9+
'djpico',
10+
)
11+
```
12+
13+
14+
3. Include the polls URLconf in your project urls.py like this::
15+
16+
`url(r'^pico/', include('djpico.urls')),`
17+
18+
19+
20+
See [Pico](https://github.com/fergalwalsh/pico/) for more information.

djpico/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""
2+
django-pico is a wrapper for the pico web application framework.
3+
4+
Copyright (c) 2013, Fergal Walsh.
5+
License: BSD
6+
"""
7+
8+
__author__ = 'Fergal Walsh'
9+
__version__ = '0.0.1'

djpico/urls.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from django.conf.urls import patterns, url
2+
3+
urlpatterns = patterns(
4+
'',
5+
url(r'pico.js|client.js', 'djpico.views.picojs', name='picojs'),
6+
url(r'^.*$', 'djpico.views.index', name='index'),
7+
)

djpico/views.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import pico.server
2+
from django.http import HttpResponse
3+
from django.views.decorators.csrf import csrf_exempt
4+
5+
6+
@csrf_exempt
7+
def index(request):
8+
params = {}
9+
params.update(request.GET.dict())
10+
params.update(request.POST.dict())
11+
path = '/' + request.path.split('/pico/')[-1]
12+
pico_response = pico.server.handle_api_v2(path, params)
13+
response = HttpResponse(pico_response.output)
14+
for key, header in pico_response.headers:
15+
response[key] = header
16+
return response
17+
18+
19+
def picojs(request):
20+
f = open(pico.server.pico_path + 'client.js')
21+
return HttpResponse(f.read(), mimetype='application/javascript')

setup.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import os
2+
from setuptools import setup
3+
4+
import djpico
5+
6+
README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
7+
8+
# allow setup.py to be run from any path
9+
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
10+
11+
version = djpico.__version__
12+
13+
setup(
14+
name='django-pico',
15+
version='0.0.1',
16+
packages=['djpico'],
17+
install_requires=['pico >= 1.2.1', 'django'],
18+
include_package_data=True,
19+
license='BSD License',
20+
description='A Django wrapper for the Pico web app framework',
21+
long_description=README,
22+
url='http://github.com/fergalwalsh/django-pico',
23+
download_url='https://github.com/fergalwalsh/django-pico/tarball/%s' % version,
24+
author='Fergal Walsh',
25+
author_email='[email protected]',
26+
classifiers=[
27+
'Environment :: Web Environment',
28+
'Framework :: Django',
29+
'Intended Audience :: Developers',
30+
'License :: OSI Approved :: BSD License',
31+
'Operating System :: OS Independent',
32+
'Programming Language :: Python',
33+
'Programming Language :: Python :: 2',
34+
'Programming Language :: Python :: 2.7',
35+
'Topic :: Internet :: WWW/HTTP',
36+
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
37+
],
38+
)

0 commit comments

Comments
 (0)