Top-rated recipes tagged "django"http://code.activestate.com/recipes/tags/django/top/2011-06-21T22:10:31-07:00ActiveState Code Recipesslugify: make a string usable in a URL or filename (Python) 2010-06-07T04:11:55-07:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/577257-slugify-make-a-string-usable-in-a-url-or-filename/ <p style="color: grey"> Python recipe 577257 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/django/">django</a>, <a href="/recipes/tags/filename/">filename</a>, <a href="/recipes/tags/slug/">slug</a>, <a href="/recipes/tags/slugify/">slugify</a>, <a href="/recipes/tags/url/">url</a>). Revision 2. </p> <p>"Slugify" a string so it is ascii, has only alphanumeric and hyphen characters. Useful for URLs and filenames. This is heavily based on the slugify in Django.</p> <p>Note: presumes that you've <code>import re</code>d higher up in your module.</p> Managment command to deploy a Django project (Python) 2011-06-21T22:10:31-07:00Filippo Squillacehttp://code.activestate.com/recipes/users/4174931/http://code.activestate.com/recipes/577767-managment-command-to-deploy-a-django-project/ <p style="color: grey"> Python recipe 577767 by <a href="/recipes/users/4174931/">Filippo Squillace</a> (<a href="/recipes/tags/django/">django</a>). </p> <p>This recipe shows a management command for django project that enables automatic synchronization between the local and remote project. Of course, the deploy exclude to overwrite the settings.py located in the remote server.</p> <p>This is a clean way to deploy your own project without calling external commands, although this command needs rsync to work.</p> Show all url patterns in django (Python) 2010-03-26T20:04:08-07:00Michael Grünewaldhttp://code.activestate.com/recipes/users/4172244/http://code.activestate.com/recipes/576974-show-all-url-patterns-in-django/ <p style="color: grey"> Python recipe 576974 by <a href="/recipes/users/4172244/">Michael Grünewald</a> (<a href="/recipes/tags/django/">django</a>, <a href="/recipes/tags/urls/">urls</a>). Revision 5. </p> <p>This small script shows a simple formatted tree of all defined django url patterns.</p> model teste (Python) 2009-09-09T08:52:31-07:00Marcello(Harry) Bontempo Salgueirohttp://code.activestate.com/recipes/users/4166255/http://code.activestate.com/recipes/576899-model-teste/ <p style="color: grey"> Python recipe 576899 by <a href="/recipes/users/4166255/">Marcello(Harry) Bontempo Salgueiro</a> (<a href="/recipes/tags/django/">django</a>). </p> <p>this is a exemple of OS </p> admin django (Python) 2009-09-09T08:51:18-07:00Marcello(Harry) Bontempo Salgueirohttp://code.activestate.com/recipes/users/4166255/http://code.activestate.com/recipes/576898-admin-django/ <p style="color: grey"> Python recipe 576898 by <a href="/recipes/users/4166255/">Marcello(Harry) Bontempo Salgueiro</a> (<a href="/recipes/tags/django/">django</a>). </p> <p>this is a teste of admin with tabular line</p> Python HTTP POST binary file upload with pycurl (Python) 2008-08-14T04:47:36-07:00Robert Lujohttp://code.activestate.com/recipes/users/4044016/http://code.activestate.com/recipes/576422-python-http-post-binary-file-upload-with-pycurl/ <p style="color: grey"> Python recipe 576422 by <a href="/recipes/users/4044016/">Robert Lujo</a> (<a href="/recipes/tags/django/">django</a>, <a href="/recipes/tags/http/">http</a>, <a href="/recipes/tags/post/">post</a>, <a href="/recipes/tags/upload/">upload</a>). </p> <p>There is a way to upload file with standard python libraries (urllib, httplib, ...) as explained at <a href="http://code.activestate.com/recipes/146306/" rel="nofollow">http://code.activestate.com/recipes/146306/</a>. But that didn't worked for me for binary data. I didn't liked/tried solution explained at <a href="http://fabien.seisen.org/python/urllib2_multipart.html" rel="nofollow">http://fabien.seisen.org/python/urllib2_multipart.html</a>, so I tried with pycurl (<a href="http://pycurl.sourceforge.net/" rel="nofollow">http://pycurl.sourceforge.net/</a> wrapper for <a href="http://curl.haxx.se/libcurl/" rel="nofollow">http://curl.haxx.se/libcurl/</a>) because it is std. lib for php, and uploading the file is very simple (just add @&lt;path-to-file&gt; to post variable value). It was a little hard to find proper way because there is no such example or documentation. But I found it, and it is so simple ;)</p> <p>I supply django test application which receives file that is uploaded.</p>