-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
294 lines (257 loc) · 7.26 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<!DOCTYPE html>
<!--
Google HTML5 slide template
Authors: Luke Mahé (code)
Marcin Wichary (code and design)
Dominic Mazzoni (browser compatibility)
Charles Chen (ChromeVox support)
URL: http://code.google.com/p/html5slides/
Adaptation: Nicolas Ferrari (alwaysdata)
-->
<html>
<head>
<title>Django @alwaysdata</title>
<meta charset='utf-8'>
<script
src='slides.js'></script>
</head>
<style>
/* alwaysdata custom style */
.slides.template-default > article:not(.nobackground):not(.biglogo) {
background: url(images/alwaysdata.png) bottom right no-repeat !important;
background-color: white !important;
}
.purple {
color: #A72277;
}
pre.ad {
font-size: 18px;
margin-bottom: 10px;
line-height: 18px;
}
pre.fs {
width: 340px;
line-height: 20px;
}
pre.fs2 {
margin-right: 20px;
}
pre.shell {
background-color: #111;
color: #eee;
font-size: 14px;
line-height: 16px;
}
p.dates {
font-size: 16px;
line-height: 20px;
}
p.legend {
font-size: 18px;
margin-top: 5px;
}
p.smaller {
font-size: 24px;
}
</style>
<body style='display: none'>
<section class='slides layout-regular template-default'>
<article>
<h1>
Using Django <span class="purple">@alwaysdata</span>
</h1>
<br /><br />
<p>Nicolas Ferrari</p>
<p class="dates">
Nov. 5, 2012 (Paris, France)
<br />
Nov. 17, 2012 (Rennes, France)
<br />
Nov. 24, 2012 (Toulouse, France)
</p>
</article>
<article>
<h3>About alwaysdata.com</h3>
<p>Hosting platform. Support Django.
<br /><br />
<img class="centered" src="images/awful_wiring.jpg" width="400px"/>
</p>
</article>
<article>
<h3>Transitioning to Django</h3>
<p>Why?
<br /><br />
<img class="centered" src="images/boulet.jpg" width="400px"/>
</p>
</article>
<article class='fill'>
<h3>Awesomeness</h3>
<p>
<img src='images/superpowers.gif'>
</p>
</article>
<article class='fill'>
<h3>File structure</h3>
<p>
<img src='images/inception.jpg'>
</p>
</article>
<article>
<h3>Initial file structure</h3>
<pre class="ad fs" style="float:left;">
.
├── administration_
│ ├── settings.py
│ ├── urls.py
│ ├── administration
│ │ ├── models.py
│ │ ├── templates
│ │ └── views.py
├── website_
│ ├── settings.py
│ ├── urls.py
│ └── website
│ ├── models.py
│ ├── templates
│ └── views.py
├── etc.
.
</pre>
<img style="float:right;margin-top:40px;" src="images/noob.jpg" />
</article>
<article>
<h3>Current file structure</h3>
<pre class="ad fs fs2" style="float:left;">
.
├── administration
│ ├── templates
│ │ ├── alerts
│ │ └── invoice
│ ├── templatetags
│ └── views
├── fixtures
├── overlord
│ └── templates
│ └── admin
├── phpmyadmin
│ └── templates
├── phppgadmin
│ └── templates
├── reseller
│ ├── templates
│ ├── templatetags
│ └── views
├── status
│ └── templates
├── webmail
│ ├── templates
│ └── views
└── website
└── templates
</pre>
<pre class="ad fs" style="float:left;">
├── common
│ ├── billing
│ │ ├── payment
│ │ └── wallets
│ ├── cruds
│ ├── domains
│ ├── mails
│ ├── models
│ ├── scripts
│ ├── services
│ ├── sites
│ │ ├── httpd
│ │ └── type
│ ├── templates
│ │ └── common
│ ├── templatetags
│ ├── utils
│ └── vendors
│ ├── domains
│ ├── sms
│ └── telephone
</pre>
</article>
<article class='fill'>
<h3>Signals</h3>
<p>
<img src='images/charlot.jpg'>
</p>
</article>
<article>
<h3>Signals (example)</h3>
<pre>
def database_user_delete(sender, instance, **kwargs):
if settings.ENABLE_ARCHITECTURE_OPERATIONS:
alwaysdata.common.scripts.database.delete_user(instance)
pre_delete.connect(database_user_delete, sender=DatabaseUser)
</pre>
<p>
<img class="centered" src='images/scarecrow.jpg' height="300px">
</p>
</article>
<article id="crud" class='fill'>
<p>
<img src='images/crud.jpg' height="700px">
</p>
</article>
<article>
<h3>Custom CRUD library (simple example)</h3>
<pre class="ad" style="font-size:15px;">
class FtpUserCrud(django_crud.ModelCrud):
model = FtpUser
form_class = FtpUserForm
operations = 'CRUDL'
url_prefix = 'ftp'
decorators = [permission_required('account_ftp')]
def get_success_url(self):
return reverse('domain_read', args=(self.domain.id,))
def get_created_message(self):
return mark_safe(_(u"L'utilisateur FTP <b>%s</b> a été créé.") % self.object.name)
django_crud.handler.TemplateHandler.register(FtpUserCrud)
</pre>
<p class="legend">get_object(), get_queryset(), get_context_data(), get_form(), get_form_kwargs() and more...</p>
</article>
<article>
<h3>Custom CRUD library (api example)</h3>
<pre class="ad" style="font-size:15px;">
class ApiModelCrud(django_crud.handler.api.ApiModelCrud):
excludes = set(('password',))
url_prefix = 'v1/'
class DatabaseCrud(ApiModelCrud):
model = Database
form_class = DatabaseForm
operations = 'RUL'
decorators = [permission_required('account_database')]
url_prefix = ApiModelCrud.url_prefix + 'database'
excludes = ApiModelCrud.excludes | set(('account', ))
container_fields = ['options',]
django_crud.handler.ApiHandler.register(DatabaseCrud)
</pre>
<pre class="ad shell" style="margin-top:0px;">
$ curl https://api.alwaysdata.com/v1/database/12345/ -u /batman:apikeyapikeyapikeyapikeyapikey
HTTP/1.1 200 OK
{
"id": 12345,
"href": "/v1/database/12345/",
"name": "batman_joker",
"type": "postgresql"
"is_postgis": false,
"encoding": "LATIN1",
}
</pre>
</article>
<article>
<h3>Thank you!</h3>
<p class="smaller">
<img width="50px" style="vertical-align:middle" src="images/twitter.png"/> @alwaysdata
<br />
<img width="50px" style="vertical-align:middle" src="images/twitter.png"/> @ferrouzzz or <strong>nferrari</strong> on irc://irc.freenode.net/alwaysdata
<br /><br />
<img class="centered" src="images/question.jpg" />
</p>
</article>
</section>
</body>
</html>