Skeleton for Nelen & Schuurmans projects
Django code skeletons
nensskel provides so-called “paster templates” for easy creation of new django applications, websites and python libraries. They’re not fully generic, as they originate within one company. See the note further down.
The nensskel script creates a directory structure with lots of basic files (like a readme and a setup.py) already there and partially filled in. Optionally it also creates a trunk/tags/branches structure in svn for you.
Just call the nensskel script to get usage information.
Installation can be done with pip or easy_install:
$ easy_install nensskel
(Probably you need to run it with sudo on osx/linux).
Don’t forget to update from time to time:
$ easy_install --upgrade nensskel
Nensskel originates at Nelen & Schuurmans, so we’ve of course set it up just the way we like it. And we change it the way we like it.
It does, however, give you a good example for full django applications/sites with a complete setup. For example, the django sites come with a full-blown apache config. And django-staticfiles is included for the easy css/js setup.
Example for your own skeleton
When you want to create your own skeleton, nensskel can be a nice, small example. Just download the .tar.gz and unpack it.
Do the regular python bootstrap.py && bin/buildout and you’re set up. The nensskel and paster script are created in the bin/ directory.
There’s one python script in nensskel/*.py per template. The actual templates are in nensskel/templates/*. See http://pythonpaste.org/script/developer.html for some limited documentation on what paster can do. If you want more elaborate examples: http://svn.plone.org/svn/collective/ZopeSkel/trunk/ is the most elaborate set of templates available.
Changelog for nensskel
- Added lizard-wms (and lizard-maptree) to the lizardsite template. Almost every site needs them and it makes the empty site more suited for demo purposes and experimenting.
- Fixed small issues in the lizardsite template:
- Added auto-checkout plus explanation to its buildout config.
- Generated random password for the production/staging databases.
- Using site name as database name.
- Git instructions are now printed after generating the project (if we’re not generating an svn project). It assumes nens/lizardsystem github URLs (which you can change, of course).
- Added more example imports to views.py and models.py, for instance the ugettext/ugettext_lazy import. And the lizard-ui and lizard-map base class based views.
- Added example class based view configuration in urls.py.
- Added admin.py.
- Added the from __future__ import unicode_literals import to use unicode everywhere.
- Updated .gitignore: we now ignore the nginx config files instead of the not-used-anymore apache ones.
- Added nensskel version number to the generated ‘initial generation’ changelog entry.
- Removed TODO.rst from all the templates. We don’t actually use it.
- Added configuration for testing on travis.
- Using url() instead of tuples in the url patterns again. Plus fixed syntax error there.
- Updated lizardsite skeleton to latest server configuration and fabfile.
- Added stagingsettings.py, staging.cfg
- Made tests work
- Added a templates/ subdirectory to the djangoapp.
- Renamed media/ dir in djangoapp to static/ to match Django 1.3.
- Using latest and greatest server setup. Including nginx and sitesetup.
- Added MEDIA_URL and MEDIA_ROOT to the djangoapp template. The debugmode urlpatterns loaded in urls.py fail with a traceback otherwise.
- Updated the .coveragerc to be more complete.
- Not git-ignoring *.mo files by default: django doesn’t compile them on the fly, so they need to be included with the source code.
- Using ‘graft’ option in the MANIFEST.in to just include everything in our project directory. .pyc/pyo files are excluded anyway, so this is more or less OK.
- Important bugfix: the “hidden” .something files weren’t being generated. They are now.
- Added git ignore file and basic MANIFEST.in to the templates.
- Removed unneeded lizard-ui middleware as django 1.3’s logging handles it.
- Adjusted context processors to django 1.3’s default list.
- Added logging setup for sentry in the lizard site template.
- Cleaned up the urls.py from djangoapp.
- Added the KGS to djangoapp and sites and updated for django 1.3.
- Removed map_settings from lizardsite settings.py.
- Commented out wsgiimmportscript in apache conf (it gives an error).
- Added lizard-map context processor (outcommented) in lizardsite settings.py.
- Adding deadlock-timeout and especially display-name to the wsgi config. The deadlock might help with shapefiles clogging up the server. The display-name shows you which server is actually using up the CPU/mem instead of just showing ‘apache2’.
- Re-release of 1.12 as that download tarball was broken.
- Adding django.contrib.gis to the INSTALLED_APPS lists as that’s needed for south migrations of geo fields.
- nens_djangoapp’s testsettings.py was missing an import os.
- Modifying the middleware to include SentryResponseErrorIdMiddleware.
- Added django-sentry to the Lizardsite template.
- Adding new file setup.py_tmpl to Lizardsite template.
- Updating +package+/settings.py_tmpl which adds sentry to INSTALLED_APPS.
- Adding mostly-empty READMEs to the two empty ‘fixtures’ and ‘media/+package+’ dirs in the django app template. On some machines, the empty directories were not getting created. This way they are.
- Svn-ignoring the doc/build directory (with sphinx output).
- Added svn revert instructions for testsettings.py in the website template (in addition to removing the file).
- Small restructured text heading level fixes for the sphinx documentation.
- Removed buildout usage part from the readme.rst as it gets repeated lots of times all over the place this way.
- Added matplotlib tweaks to the django site settings.py.
- Added django-extensions to the standard dependencies of django apps so that we can get a model graph.
- Added sphinx setup. Also swapped the .txt files for .rst ones.
- Fixed too-restrictive regex in apache’s openlayers AliasMatch: the openlayers css/icons now also work in the root of the site…
- Added sysegg part to the buildouts.
- Printing .egginfo directory removal instructions.
- Updated list of standard svn:ignores.
- Added django gzip middleware to the lizardsite template.
- Added lizard-ui’s traceback logging middleware to lizardsite.
- Added lizard-map’s map settings to the django settings.py in lizardsite.
- Removed windows apache configuration.
- Added gzip (“mod_deflate”) for js/css in the apache config.
- Eternally caching the django-compressor combined js/css files.
- Added logging setup to lizardsite.
- Added 500.html and 404.html to lizardsite template.
- Added openlayers img/ and theme/ aliases to compensate for openlayers’ weirdness.
- Added extra part to the lizardsite buildout for automatic bin/django build_static running so we won’t ever forget to do that.
- Updated database settings to new django multiple databases style.
- Added setup.cfg that tells nose to output xml test reports for use with Hudson.
- Fixes to the test setup of django_app.
- Added copyright notice at the top of every file including pointer to the LICENSE.txt GPL file. No, I’m not copy/pasting 10 unneeded lines of GPL boilerplate into every file.
- Bootstrap.py adjustments: using the 1.4.x buildout one for now.
- Documentation update.
- Changed test setup of djangoapp and lizardsite to match Reinout’s latest experiments :-)
- Added coverage support both to nensskel itself and to the templates.
- Added django compressor settings to the lizardsite template.
- Added lizard-ui as a standard dependency for django applications.
- Removed ipython as it regularly fails to download, sadly. Can be re-added after buildout gains a timeout setting (in the .cfg files).
- Django STATIC_URL/MEDIA_URL clarification and usage improvement after discussion on http://bitbucket.org/jezdez/django-staticfiles/issue/12/
- Added apache config (with a separate one for windows that still needs some work).
- Django fixes after using skeleton in real life.
- Added nensskel script as a handy wrapper around paster create.
- Added lizardsite skeleton (which needs checking and probably modifications).
- Added djangoapp skeleton.
- Added library skeleton.
- Added test that creates instances of all skeletons and runs their bin/buildout. Smoke test: switch everything on and see if smoke comes out.
- Reinout copied relevant parts from the thaskel and zestskel that he made for the two previous companies he worked for.