Skip to content

Commit 3b33ff7

Browse files
committedMay 9, 2013
initial version
0 parents  commit 3b33ff7

13 files changed

+621
-0
lines changed
 

‎COPYING

+411
Large diffs are not rendered by default.

‎README.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{{project_name}}
2+
=====================
3+
4+
This project was started with the Django installable plugin template. This has created a development environment that does not require an entire django deployment to develop and test an installable module. The following instructions will be useful for anyone developing this project.
5+
6+
Using the development environment
7+
---------------------------------
8+
Install requirements
9+
10+
pip install fabric
11+
pip install -r requirements.txt
12+
13+
Setup db
14+
15+
fab syncdb
16+
fab migrate
17+
18+
Start server
19+
20+
fab serve
21+
22+
Using the Python shell
23+
24+
fab shell
25+
26+
Running tests
27+
28+
fab test
29+
30+
Creating South schema migrations
31+
32+
fab schema
33+
fab migrate
34+
35+
36+
37+
#REPLACE EVERYTHING AFTER THIS WITH YOUR INFO#
38+
39+
Django installable plugin template
40+
Copyright 2013 Jeremy Satterfield
41+
Licensed under GPLv3 see COPYING for license

‎__init__.py

Whitespace-only changes.

‎fabfile.py

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""
2+
Creating standalone Django apps is a PITA because you're not in a project, so
3+
you don't have a settings.py file. I can never remember to define
4+
DJANGO_SETTINGS_MODULE, so I run these commands which get the right env
5+
automatically.
6+
"""
7+
import functools
8+
import os
9+
10+
from fabric.api import local as _local
11+
12+
13+
NAME = os.path.basename(os.path.dirname(__file__))
14+
ROOT = os.path.abspath(os.path.dirname(__file__))
15+
APP_NAME = '{{project_name}}'
16+
17+
os.environ['DJANGO_SETTINGS_MODULE'] = 'test_app.settings'
18+
os.environ['PYTHONPATH'] = os.pathsep.join([ROOT,])
19+
20+
_local = functools.partial(_local, capture=False)
21+
22+
23+
def shell():
24+
"""Start a Django shell with the test settings."""
25+
_local('django-admin.py shell')
26+
27+
28+
def test():
29+
"""Run the test suite."""
30+
_local('django-admin.py test')
31+
32+
33+
def serve():
34+
"""Start the Django dev server."""
35+
_local('django-admin.py runserver')
36+
37+
38+
def syncdb():
39+
"""Create a database for testing in the shell or server."""
40+
_local('django-admin.py syncdb')
41+
42+
43+
def schema():
44+
"""Create a schema migration for any changes."""
45+
_local('django-admin.py schemamigration %s --auto' % APP_NAME)
46+
47+
48+
def migrate():
49+
"""Update a testing database with south."""
50+
_local('django-admin.py migrate')
51+

‎project_name/__init__.py

Whitespace-only changes.

‎project_name/models.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.db import models
2+
3+
# Create your models here.

‎project_name/tests.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""
2+
This file demonstrates writing tests using the unittest module. These will pass
3+
when you run "manage.py test".
4+
5+
Replace this with more appropriate tests for your application.
6+
"""
7+
8+
from django.test import TestCase
9+
10+
11+
class SimpleTest(TestCase):
12+
def test_basic_addition(self):
13+
"""
14+
Tests that 1 + 1 always equals 2.
15+
"""
16+
self.assertEqual(1 + 1, 2)
17+

‎project_name/views.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Create your views here.

‎requirements.txt

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
pip>=0.8.2
2+
South
3+
Django=>1.4
4+
5+
# install these if you intend to develop
6+
#mox
7+
#nose
8+
#django-nose
9+
#fabric

‎setup.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env python
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from setuptools import setup
16+
17+
setup(name='django-{{project_name}}',
18+
version='0.0.1',
19+
description='',
20+
author='Your Name Here',
21+
author_email='Email',
22+
#url='',
23+
#license='',
24+
packages=[
25+
'{{project_name}}', '{{project_name}}.migrations'],
26+
install_requires=[
27+
'South',
28+
'Django>=1.5',],
29+
classifiers=[
30+
'Development Status :: 4 - Beta',
31+
'Environment :: Web Environment',
32+
'Framework :: Django',
33+
'Intended Audience :: End Users/Desktop',
34+
'Programming Language :: Python',],
35+
)

‎test_app/__init__.py

Whitespace-only changes.

‎test_app/settings.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
DEBUG = True
2+
TEMPLATE_DEBUG = DEBUG
3+
4+
DATABASES = {
5+
'default': {
6+
'ENGINE': 'django.db.backends.sqlite3',
7+
'NAME': 'test.db',
8+
}
9+
}
10+
USE_TZ = False
11+
SITE_ID = 1
12+
SECRET_KEY = '{{secret_key}}'
13+
14+
ROOT_URLCONF = 'test_app.urls'
15+
STATIC_URL = '/static/'
16+
17+
INSTALLED_APPS = (
18+
'django.contrib.admin',
19+
'django.contrib.auth',
20+
'django.contrib.contenttypes',
21+
'django.contrib.sessions',
22+
'django.contrib.sites',
23+
'django.contrib.messages',
24+
'django.contrib.staticfiles',
25+
'django_nose',
26+
'south',
27+
'{{project_name}}',
28+
)
29+
30+
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
31+
NOSE_ARGS = ('--nocapture', )

‎test_app/urls.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from django.conf.urls import patterns, include, url
2+
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
3+
4+
# Uncomment the next two lines to enable the admin:
5+
from django.contrib import admin
6+
admin.autodiscover()
7+
8+
urlpatterns = patterns('',
9+
# Examples:
10+
# url(r'^$', 'podcast_client.views.home', name='home'),
11+
# url(r'^podcast_client/', include('podcast_client.foo.urls')),
12+
13+
# Uncomment the admin/doc line below to enable admin documentation:
14+
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
15+
16+
# Uncomment the next line to enable the admin:
17+
# url(r'^admin/', include(admin.site.urls)),
18+
19+
url(r'^{{project_name}}/',
20+
include('{{project_name}}.urls', '{{project_name}}')),
21+
)
22+
urlpatterns += staticfiles_urlpatterns()

0 commit comments

Comments
 (0)
Please sign in to comment.