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 http://dsnp.googlecode.com/svn/trunk/
python dsnp.py myproject
cd myproject
python manage.py runserver
Browse http://localhost:8000/
Easy right?
yes, easy.. but i can already do that with the command line tools that come with django... how does this differ?
ReplyDeleteit do help a lot for newbies of django
ReplyDeletesaves much time for checking up the documentation
and get the demo site running immediately!
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.
ReplyDeleteWe 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.
ReplyDeleteRunning off svn of django got error
ReplyDeleteAttributeError: 'module' object has no attribute 'transdb'
My fault. Now is fixed, thank you for pointing me out.
ReplyDeleteCool improvements !!! They can be used to test lot of things now, and very easily !!!
ReplyDeletebtw, 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.
Thanks for the script.
ReplyDeleteI had to add 'django.template.loaders.filesystem.load_template_source', to TEMPLATE_LOADERS in the settings template.
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.
ReplyDeleteapple][kid, this template loader only is required if you want to place your templates outside yourproject/www/templates.
Still have this error after svn sync:
ReplyDeleteImproperlyConfigured at /
Error while importing URLconf 'testme.urls': 'module' object has no attribute 'site'
Nice work Marc. I did something similar with django-command-extensions (http://code.google.com/p/django-command-extensions/) create_app command where you can use an enhanced app creator or just point to your own directory tree.
ReplyDeleteNick, 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 urls.py trunk syntax (you've to remove the "from django.contrib import admin", and change the admin.site.root). You can see the syntax in [...]/django/conf/project_template/urls.py
ReplyDeleteHopefully 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.
Marc, thank you for script! I've installed newforms-admin and dnsp's generated site worked in 1 click!
ReplyDeleteHmm, tried DSNP for second project and got "Permission denied: d:/python25/site-packages/django/contrib/admin/media/"
ReplyDeleteProblem 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..
Hi Nick,
ReplyDeletenext post of this one in my blog is about that.
I'll fix it soon.
Thanks for the comment.