background preloader

Django

Facebook Twitter

Développez votre site web avec le framework Django. The Best (and Worst) of Django. Django Packages : Django Packages reusable apps, sites and tools directory. Toastdriven/django-tastypie. How To Install Django On OVH.net - Thomas Rabaix. Cet article explique comment installer django sur les serveurs mutualisés d'ovh.com.

How To Install Django On OVH.net - Thomas Rabaix

Django ne peut fonctionner seulement en mode cgi, donc la performance ne sera pas au rendez-vous. Mais cela conviendra tres bien pour des sites a faible fréquentation. Standalone Django scripts. In the grand tradition of providing answers to frequently-asked questions from the django-users mailing list and the #django IRC channel, I’d like to tackle something that’s fast becoming the most frequently-asked question: how do you write standalone scripts which make use of Django components?

Standalone Django scripts

At first glance, this isn’t a terribly hard thing to do: Django’s just plain Python, and all of its components can — in theory — be imported and used just like any other Python modules. But the thing that trips most people up is the need, in most parts of Django, to supply some settings Django can use so it’ll know things like which database to connect to, which applications are available, where it can find templates, etc. Depending on exactly what you need to do, there are several ways you can approach this problem, so let’s run through each of them in turn.

Set DJANGO_SETTINGS_MODULE before you run export DJANGO_SETTINGS_MODULE=yoursite.settings Use setup_environ() Use settings.configure() Mathieu Agopian : Django FileField et ImageField, upload_to et shell python. Ce champ peut être une chaîne de caractères, ou un callable.

Mathieu Agopian : Django FileField et ImageField, upload_to et shell python

Chaîne de caractères pour upload_to Pour notre example, prenons le modèle suivant: class MonModele(models.Model): fichier = models.FileField(upload_to="chemin") Dans ce cas simple, tous les fichiers seronts sauvés dans le répertoire <MEDIA_ROOT>/chemin/. Si on upload un fichier nommé MonFichier.txt, le chemin complet (sans le MEDIA_ROOT) sera chemin/MonFichier.txt. Il est par ailleurs possible d'utiliser une syntaxe strftime comme indiqué dans la documentation du module time. Pour stocker un fichier avec la date et l'heure: class MonModele(models.Model): fichier = models.FileField(upload_to="chemin/%Y%m%d_%H%M%S") Et le résultat sera chemin/2009-02-19_18:40:03/MonFichier.txt, ce qui n'est pas vraiment ce à quoi on s'attendait.

En effet, cela créera un répertoire par fichier, au lieu de stocker la date et l'heure dans le nom du fichier. Fonction pour upload_to. Jquery - Passing parameters to the Javascript code on a page using django templates. Development to Deployment in Django. One of the most important things I've done to improve my experience working with Django is to develop a consistent pipeline between development and deployment.

Development to Deployment in Django

Here I'll quickly outline some of the things I've done to make the experience easier, but I'm curious to hear about the techniques that you use as well. local_settings.py++ One of the best tricks for working with Django deployment is to end your settings.py file with these four lines: try: from local_settings import *except ImportError: pass Doing that lets you override settings.py with the contents of local_settings.py. I create a production_settings.py file with settings for production servers, and a devel_settings.py for local development. User Registration Apps for Django. An important part of many web applications is creating the illusion of state on top of the stateless HTTP protocol.

User Registration Apps for Django

Although there are some naive approaches that almost work (assuming individuals with the identical IP addresses are the same, etc), at the bottom there is only one solution that works adequately: cookies. For many applications cookie based identification--without any further identification--is sufficient1, but there also many situations where users enter important or private data, and we need to authenticate the user before allowing them access to the application and its data. As the Django framework has grown, an ecosystem of pluggable user registration has grown as well. These registration applications all tie into the Django auth and sessions modules, and have many overlaps, but choosing the best one for your application can make your life much simpler.

Rolling Your Own Registration System. Web-design and development from the Huntington, WV, Ashland, KY, and Ironton, OH tristate area. Web-design and development from the Huntington, WV, Ashland, KY, and Ironton, OH tristate area. Installer Django sous Windows. Django, qu'est ce que c'est ?

Installer Django sous Windows

Django est un framework web basé sur le langage Python qui permet un développement simple et ultra-rapide. A l'instar de Symfony ou Ruby on Rails, il suit le modèle de conception Modèle-Vue-Contrôleur ; toute la gesion de la structure des données est assurée par des classes de Modèles, les Vues permettent l'affichage des informations et enfin les Contrôleurs répondent au requêtes des utilisateurs. Ainsi, grâce à ces trois entités, le framework sera capable de générer toute une application web, en back et frontoffice. Installation La plupart des informations glanées sur Internet concernant l'installation de Django se fait souvent sous environnement Linux.

Installer Python Tout d'abord, vous devez avoir la dernière version de Python. Learn Django: Create a Wiki in 20 minutes video tutorial - Learn Django: Create a Wiki in 20 minutes - Learn: webdevelopment, python, beginners, application, programming, basics, running, time, little, pages, create, wiki, learn, library, tutorials, http, Passing Python Data to JavaScript via Django. Créer un portfolio avec Django - Conception. Les articles qui vont suivre seront dédiés à la création d'un simple portfolio en utilisant python et django.

Créer un portfolio avec Django - Conception

La saga s'ouvre avec la première étape, la plus importante : la conception de l'application. Ici, pas de code, simplement de la réflexion... Le but de ce futur portfolio sera bien évidement de présenter ses créations et de les caractériser par des mots clés et des images (captures d'écran ou autre). Chaque réalisation possédera un certain nombre de paramètres pour les illustrer. Ce sont ces paramètres que nous allons devoir définir.

L'application sera donc composée de trois entitées. TDDjangoTutorial. Are you generic? / Wilson Miner. Even more Django for non-programmers.

Are you generic? / Wilson Miner

How I built a portfolio app in 30 minutes with Django's generic views. I remember when people were just getting excited about Rails. It was all about the demo. Build a blog (or whatever) in 30 minutes. It was so elegant that even designers were getting into it. As a designer for World Online, I’ve been involved with the development of Django since before it was Django. I’ve finally been able to realize that dream (sniff), thanks to a little feature in Django called generic views. The missing link There are really three basic steps you need to build a basic web app in Django. And I can get my head around a model. Views are another story.

But most of the time I don’t need anything that complicated. That’s where generic views come in. In fact, it’s possible to build an entire app or site using entirely generic views, without writing a single line of actual view code. Tutorial — Django MongoDB Engine. The goal of this step-by-step tutorial is to introduce you to non-relational schema design and the tools Django MongoDB Engine provides to put that design into action.

This tutorial assumes that you are already familiar with Django and have a basic idea of MongoDB operation and a . Our example project covers the development of a simple single-user blog application with tag and comment capabilities. Note. Centre de ressources et documentation - Tutorial Django 1.0. 1.1 Introduction à Django Django est un framework, il était au départ développé pour un environnement de revue de presse électronique appartenant à World Online.

centre de ressources et documentation - Tutorial Django 1.0

Puis en Juillet 2005 il a été abstrait et publié comme framework web libre. Django by Example: Django Tutorials - Django by Example. Écrire votre première application Django, partie 1 — Documentation de Django 1.1.1. Intro to Unintrusive JavaScript with Django. There are quite a number of tutorials looking at using Ajax with Django.

Intro to Unintrusive JavaScript with Django

Despite that, it is still a topic that leaves many confused. I think the fundamental issue is that there are three very different groups looking for tutorials on using Ajax with Django: Experienced web developers who have used a multitude of other frameworks (and used to administer networks composed of passenger pigeons in their younger days) who just need a couple of low-level details. Web developers who have mastered one other framework (often Ruby on Rails), but need a slightly higher level of detail to get used to the differences between Django's way of doing things and their previous experience. Inexperienced web developers who have never mastered a web framework, and may have a limited grasp on Python, JavaScript, and the high-level concepts of client-server interaction that occur in Ajax applications.

Overview The first step in implementing an Ajax webapp is to implement the webapp without Ajax. That's it. Django Story : Django raconté à un ami — Django Story 1.0 documentation. Django Djumpstart: Build a To-do List in 30 Minutes. Being a web developer isn’t always exciting. There are lots of tedious things you end up doing over and over again: writing code to talk to a database, writing code to handle page templating, writing an administrative interface … Sooner or later you start to wish someone would just come along and wrap up all that repetitive code in nice, integrated, reusable packages, right? Well, today’s your lucky day, because someone finally has. Say hello to Django.