This week I continued to work on the startapp command of
django.core.management and changed its default behaviour to create a
standalone application (with skeleton files) when you run: django-. Current skeleton files are:
admin.py startapp myapprelease.py,.
setup.py, MANIFEST.in, docs/, test/, myapp/, myapp/templates/myapp
Are there any generic files/folders to add?
Besides editing release.py manually you can now edit the meta
information by running inside an application dir: django-admin.py. This also moves the app directory on a name change.
editapp
You can find a ReleaseWrapper dictionary object at
django.utils.package which can be used to read and edit your release
manually:
>> import os
>>> from django.utils.package import ReleaseWrapper, DEFAULT_DIRECTORIES, DEFAULT_FILES
>>> release = ReleaseWrapper(os.getcwd())
>>> print (release.NAME, release.VERSION)
('myapp', '0.1')
>>> release.previous_name = release.NAME
>>> release.NAME = "myapp2"
>>> release['VERSION'] = “0.2″
>>> release.update(os.getcwd(), DEFAULT_DIRECTORIES, DEFAULT_FILES)
Moved: /Users/Jannis/Desktop/test_app/myapp to /Users/Jannis/Desktop/
test_app/myapp2
Created: /Users/Jannis/Desktop/test_app/myapp2/templates/myapp2
Written: /Users/Jannis/Desktop/test_app/release.py
Written: /Users/Jannis/Desktop/test_app/setup.py
Written: /Users/Jannis/Desktop/test_app/MANIFEST.in
The application is ready to be used by setuptools, e.g. creating a zip-
like “egg” file (python setup.py bdist_egg) which then can be
distributed and installed with setuptools’ easy_install command.
Creating a stripped down project-based application (__init__.py, models.py,), which is currently recommended by the tutorials, run:
views.py
django-admin.py --noskeleton startapp mysimpleapp
Please have a look at http://code.google.com/p/django-package/ for
further details, full installation instructions and of course the
patch.
And please, tell me what you think :)

Leave a Reply