Skip to content

Commit

Permalink
More tweaks for demo app and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dakrauth committed Feb 11, 2015
1 parent 6e30d0d commit 2b63b81
Show file tree
Hide file tree
Showing 26 changed files with 48 additions and 37 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Expand Up @@ -2,7 +2,9 @@
*.pot
*.pyc
karate.db
demo/django
demo/static
docs/build
MANIFEST
dist
dist
.tox/
django_swingtime.egg-info/
11 changes: 8 additions & 3 deletions README.rst
@@ -1,15 +1,20 @@
About Swingtime
===============

.. image:: https://pypip.in/v/django-swingtime/badge.svg
:target: https://pypi.python.org/pypi/django-swingtime/

.. image:: https://pypip.in/d/django-swingtime/badge.svg
:target: https://pypi.python.org/pypi/django-swingtime/

.. image:: https://travis-ci.org/dakrauth/django-swingtime.svg?branch=master
:target: https://travis-ci.org/dakrauth/django-swingtime

.. image:: https://badge.fury.io/py/django-swingtime.svg
:target: http://badge.fury.io/py/django-swingtime

.. image:: https://pypip.in/d/django-swingtime/badge.png
:target: https://crate.io/packages/django-swingtime?version=latest

.. image:: https://pypip.in/license/django-swingtime/badge.svg
:target: https://pypi.python.org/pypi/django-swingtime/

Welcome
-------
Expand Down
Empty file removed demo/demo_site/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion demo/karate/management/commands/loaddemo.py
Expand Up @@ -114,7 +114,7 @@ class Command(NoArgsCommand):

#---------------------------------------------------------------------------
def handle_noargs(self, **options):
dbpath = os.path.join(settings.PROJECT_DIR, settings.DATABASES['default']['NAME'])
dbpath = settings.DATABASES['default']['NAME']
if os.path.exists(dbpath):
self.stdout.write(Term.warn('Removing old database %s' % dbpath))
os.remove(dbpath)
Expand Down
2 changes: 1 addition & 1 deletion demo/manage.py
Expand Up @@ -3,7 +3,7 @@
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "demo_site.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")

from django.core.management import execute_from_command_line

Expand Down
1 change: 1 addition & 0 deletions demo/requirements.txt
Expand Up @@ -2,3 +2,4 @@ python-dateutil
Django<1.8
django-extensions
Sphinx
sphinx_rtd_theme
9 changes: 8 additions & 1 deletion demo/rundemo
@@ -1,9 +1,16 @@
#!/bin/bash
PYWARN='python -Wd'
pip install -r requirements.txt
cd ../docs
make html
cd -
VER=$(python manage.py --version)
$PYWARN manage.py loaddemo
$PYWARN manage.py collectstatic --noinput --link
if [[ "$VER" > "1.6" ]]
then
$PYWARN manage.py check
fi
$PYWARN manage.py loaddemo

$PYWARN manage.py runserver

24 changes: 6 additions & 18 deletions demo/demo_site/settings.py → demo/settings.py
Expand Up @@ -6,29 +6,20 @@
except ImportError:
raise ImportError('django-swingtime requires the "python-dateutil" package')

SITE_DIR = os.path.dirname(os.path.abspath(__file__))
PROJECT_DIR = os.path.dirname(SITE_DIR)
sys.path.extend([
os.path.abspath('..'), # relative path to karate app
os.path.abspath('../..'), # relative location of swingtime app
os.path.abspath('..'), # relative location of swingtime app
])

DEBUG = TEMPLATE_DEBUG = True
DATABASES = {'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'karate.db',
}}

STATIC_URL = '/static/'
STATIC_ROOT = 'static'
TIME_ZONE = 'America/New_York'
SITE_ID = 1
USE_I18N = True

MEDIA_ROOT = os.path.join(SITE_DIR, 'media')
MEDIA_URL = '/media/'

STATIC_ROOT = os.path.join(SITE_DIR, 'static')
STATIC_URL = '/static/'

SECRET_KEY = 'swingtime-demo'
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.debug',
Expand All @@ -38,11 +29,8 @@
'swingtime.context_processors.current_datetime',
)

ROOT_URLCONF = 'demo_site.urls'
TEMPLATE_DIRS = (
os.path.join(SITE_DIR, 'templates'),
)

ROOT_URLCONF = 'urls'
TEMPLATE_DIRS = ('templates',)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
Expand All @@ -62,7 +50,7 @@
'django.contrib.messages.middleware.MessageMiddleware',
)

SWINGTIME_SETTINGS_MODULE = 'demo_site.swingtime_settings'
SWINGTIME_SETTINGS_MODULE = 'swingtime_settings'

try:
import django_extensions
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 1 addition & 3 deletions demo/demo_site/urls.py → demo/urls.py
@@ -1,13 +1,11 @@
import os
from django.conf import settings
from django.contrib import admin
from django.views.static import serve
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView, RedirectView

admin.autodiscover()
site_dir = os.path.dirname(settings.SITE_DIR)
doc_root = os.path.join(os.path.dirname(site_dir), 'docs/build/html')
doc_root = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'docs/build/html')

urlpatterns = patterns('',
url(r'^$', TemplateView.as_view(template_name='intro.html'), name='demo-home'),
Expand Down
2 changes: 1 addition & 1 deletion demo/demo_site/wsgi.py → demo/wsgi.py
Expand Up @@ -6,7 +6,7 @@
sys.path.extend([ROOT_DIR, SITE_DIR])
sys.stdout = sys.stderr

os.environ['DJANGO_SETTINGS_MODULE'] = 'demo_site.settings'
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
os.chdir(SITE_DIR)

from django.core.wsgi import get_wsgi_application
Expand Down
24 changes: 17 additions & 7 deletions docs/conf.py
Expand Up @@ -11,19 +11,23 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys, os
import sys, os, datetime

# If your extensions are in another directory, add it here. If the directory
# is relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
#sys.path.append(os.path.abspath('.'))

sys.path.append(os.path.abspath('..'))

import swingtime
VERSION = swingtime.VERSION

# General configuration
# ---------------------

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc']
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand All @@ -39,16 +43,16 @@

# General information about the project.
project = u'Swingtime'
copyright = u'2014, David Krauth'
copyright = u'{}, David Krauth'.format(datetime.datetime.now().year)

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.3'
version = '.'.join(map(str, VERSION[:2]))
# The full version, including alpha/beta/rc tags.
release = '0.3.2'
release = '.'.join(map(str, VERSION))

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -87,8 +91,14 @@

# Options for HTML output
# -----------------------
try:
import sphinx_rtd_theme
except ImportError:
html_theme = "default"
else:
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

html_theme = "nature"

# The style sheet to use for HTML and HTML Help pages. A file of that name
# must exist either in Sphinx' static/ path, or in one of the custom paths
Expand Down

0 comments on commit 2b63b81

Please sign in to comment.