Wednesday, May 7, 2008

New DSNP version

DSNP is a simple and customizable Python script, that automatically creates a working Django project.

Project (and application) creation in Django are very openend and flexible, but sometimes is useful getting all the work done for you, specially:

  • If you create many Django projects with the same structure.

  • If you're new to Python, and want to see a "hello world!" application working in less than one minute.

  • If you want to check your Django structure with somebody's else (me).

DSNP does exactly that, automates the process of creating projects and applications in Django. The resulting website is a simple project with a single application, ready for start creating models and templates. It's also customizable, to let everyone set their own preferences in the script, and adapt it to your desired structure.

Want to try it (in five simple steps)?

svn checkout
python myproject
cd myproject
python runserver
Browse http://localhost:8000/

Easy right?


  1. yes, easy.. but i can already do that with the command line tools that come with django... how does this differ?

  2. it do help a lot for newbies of django
    saves much time for checking up the documentation
    and get the demo site running immediately!

  3. Look at the source -- it does a lot the normal cl tool doesn't. It creates media directories, a default template, sets up URLs, sets up an sqlite db and syncs the database not to mention a few other little things. If nothing else it's a great template to use if you want to create your own one-step rollout of a new django project or development environment. It's also quite functional on its own.

  4. We have a similar script at work that sets up a project, the database and adds in a couple of apps that we use a lot of the time. It is very similar to yours Marc, but doesn't use templates for the settings files.

  5. Running off svn of django got error

    AttributeError: 'module' object has no attribute 'transdb'

  6. My fault. Now is fixed, thank you for pointing me out.

  7. Cool improvements !!! They can be used to test lot of things now, and very easily !!!

    btw, I am getting this exception on the "intranet" place:

    Permission denied: /usr/lib/python2.5/site-packages/django/contrib/admin/media/

    don't know if is just my local configuration or any other problem.

  8. Thanks for the script.

    I had to add 'django.template.loaders.filesystem.load_template_source', to TEMPLATE_LOADERS in the settings template.

  9. Robert, Ithink that is a Django issue when canging 'admin' url, and testing with runserver. Using apache or restoring admin name from 'intranet' (in DSNP) to default 'admin should solve this issue. I'll research more on this issue soon.

    apple][kid, this template loader only is required if you want to place your templates outside yourproject/www/templates.

  10. Still have this error after svn sync:

    ImproperlyConfigured at /
    Error while importing URLconf 'testme.urls': 'module' object has no attribute 'site'

  11. Nice work Marc. I did something similar with django-command-extensions ( create_app command where you can use an enhanced app creator or just point to your own directory tree.

  12. Nick, DSNP settings are configured for newforms-admin branch, so if you want to use it with trunk, you've to edit the script, and set the URLS_PROJECT_TEMPLATE to the trunk syntax (you've to remove the "from django.contrib import admin", and change the You can see the syntax in [...]/django/conf/project_template/

    Hopefully newforms-admin branch will be merged soon, and we'l avoid all this kind of problems.

    Michael, thanks for the link to the project; I didn't heard about that. It looks nice, I was thinking in something like that when creating DSNP, but finally I decided to create a simpler script that creates most os the repetitive work, and everything can be changed afterwards.

  13. Marc, thank you for script! I've installed newforms-admin and dnsp's generated site worked in 1 click!

  14. Hmm, tried DSNP for second project and got "Permission denied: d:/python25/site-packages/django/contrib/admin/media/"

    Problem dissappered when I changed ADMIN_MEDIA_PREFIX:

    ADMIN_MEDIA_PREFIX = '/myadmin/'

    Also renamed directory in media from 'admin' to 'myadmin'.
    Hope it will help somebody..

  15. Hi Nick,

    next post of this one in my blog is about that.

    I'll fix it soon.

    Thanks for the comment.