Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Démarrer un projet Django
Search
xordoquy
November 06, 2012
Programming
1
140
Démarrer un projet Django
Quelques points à voir lorsque l'on démarre son projet Django.
xordoquy
November 06, 2012
Tweet
Share
More Decks by xordoquy
See All by xordoquy
pycon.fr 2018 - Django REST framework workshop
xordoquy
0
230
mauvaises bonnes idées pour REST
xordoquy
1
330
Authentication and Permissions with Django REST framework
xordoquy
0
170
Buildbot 0.9
xordoquy
0
94
Performances Django REST framework - DjangoCong 2016
xordoquy
0
120
Présentation de l'architecture REST - meetup Django Paris
xordoquy
0
110
Django REST framework workshop @Djangocon Europe 2015
xordoquy
0
110
Django REST framework - DjangoConG 2015
xordoquy
3
140
Django REST framework workshop - DjangoCong 2015
xordoquy
1
110
Other Decks in Programming
See All in Programming
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
170
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
900
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.7k
Jakarta Concurrencyによる並行処理プログラミングの始め方 (JJUG CCC 2024 Fall)
tnagao7
1
290
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
24k
Jakarta EE meets AI
ivargrimstad
0
540
CSC509 Lecture 12
javiergs
PRO
0
160
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.1k
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
290
Remix on Hono on Cloudflare Workers
yusukebe
1
290
Featured
See All Featured
Ruby is Unlike a Banana
tanoku
97
11k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
Designing Experiences People Love
moore
138
23k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
860
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
The Pragmatic Product Professional
lauravandoore
31
6.3k
Transcript
Démarrer un projet Django Xavier Ordoquy
Environnement virtuel • virtualenv / virtualenvwrapper • pip • utilisez
les fichiers requirements.txt !!! • $ pip install Django
Création • $ django-admin.py startproject demo $ find demo demo
demo/manage.py demo/demo demo/demo/__init__.py demo/demo/settings.py demo/demo/urls.py demo/demo/wsgi.py $ mkdir demo/media $ mkdir demo/theme
MEDIA et STATIC • STATIC: fichiers projet • MEDIA: fichiers
utilisateur • Utilisez Apache / Nginx / ... en production
settings.py from os.path import dirname, join, normpath DEBUG = True
PROJECT_ROOT = normpath(join('..', dirname(__file__))) MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media') STATIC_URL = '/static/' STATICFILES_DIRS += (join(PROJECT_ROOT, 'theme'),) INSTALLED_APPS += (django.contrib.staticfiles,)
urls.py from django.conf import settings from django.conf.urls.static import static urlpatterns
= ( ... ) urlpatterns += static( settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Django debug toolbar DjDT
templates contexte SQL
configuration INTERNAL_IPS = ('127.0.0.1',) INSTALLED_APPS = ( ... 'debug_toolbar', )
MIDDLEWARE_CLASSES = ( # ... 'debug_toolbar.middleware.DebugToolbarMiddleware', # ... ) $ pip install django-debug-toolbar
Sentry / Raven
None
configuration INSTALLED_APPS += ('raven.contrib.django',) SENTRY_DSN = http://fb..18:
[email protected]
/12 $ pip install
django-debug-toolbar
Applications génériques
Générique • Packaging Python: • facilité d’installation • gestion des
dépendances • pypi.python.org ? • Prévoir un système de migration
Générique • GenericForeignKey • Garder en dehors du projet
Trucs et astuces
generic class based views pour les prototypes
Mettez votre thème dans une application
Utilisez Debug Toolbar pour comprendre l’ORM
Il existe une application tiers: www.djangopackages.com pypi.python.org
irc: #django-fr Don’t ask to ask
Liens http://www.doughellmann.com/projects/virtualenvwrapper/ http://pypi.python.org/pypi/virtualenv https://github.com/django-debug-toolbar/django-debug-toolbar https://www.getsentry.com/docs/
[email protected]
@linovia_net irc: #django-fr Questions ?