Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Démarrer un projet Django
Search
Ordoquy Xavier - Linovia
November 06, 2012
Programming
160
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Démarrer un projet Django
Quelques points à voir lorsque l'on démarre son projet Django.
Ordoquy Xavier - Linovia
November 06, 2012
Transcript
23 slides
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 ?
More Decks by Ordoquy Xavier - Linovia
See All by Ordoquy Xavier - Linovia
Comprendre les interruptions de service lors des mises en production.
xordoquy
0
20
SQLAlchemy - un ami qui vous veut du bien
xordoquy
0
31
pycon.fr 2018 - Django REST framework workshop
xordoquy
0
360
mauvaises bonnes idées pour REST
xordoquy
1
420
Authentication and Permissions with Django REST framework
xordoquy
0
210
Buildbot 0.9
xordoquy
0
110
Performances Django REST framework - DjangoCong 2016
xordoquy
0
140
Présentation de l'architecture REST - meetup Django Paris
xordoquy
0
120
Django REST framework workshop @Djangocon Europe 2015
xordoquy
0
130
Other Decks in Programming
See All in Programming
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
290
protojson における文字化けの扱い
kazuki1023
0
420
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
420
Spec-driven Development with AI
simas
PRO
0
2.3k
Materialが消えた日 〜真っ白なFlutterキャンバスにRenderObjectで絵を描く〜
umigishiaoi
0
160
ビジネスロジックを堅牢に~Scala 3のドメインプリミティブ~
j5ik2o
0
160
Web3Dライブラリを作ってVue Custom Rendererの仕組みを理解しよう / lets learn vue custom renderer by making 3d library
drumath2237
1
130
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
4
3.9k
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
340
小さなアプリを作って公開するまで
onozaty
0
170
エラーチャンネルのボールを拾い続けて鍛えるエンジニアの地力 / phpcon-niigata2026
meihei3
1
120
どうしても Eloquent でリポジトリパターンをやりたいんだ #phpcon_niigata / phpcon-niigata-2026
shogogg
0
150
Featured
See All Featured
Balancing Empowerment & Direction
lara
6
1.4k
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
280
sira's awesome portfolio website redesign presentation
elsirapls
0
510
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
The agentic SEO stack - context over prompts
schlessera
0
1k
Building Adaptive Systems
keathley
44
3.3k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.3k
Tell your own story through comics
letsgokoyo
1
1.1k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
3k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.9k