/
index.html
315 lines (180 loc) · 13.1 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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Crash Course in Web2py (Part 1) - Michael Herman</title>
<meta name="author" content="Michael Herman">
<meta name="description" content="This tutorial shows how to create a basic web app using the web2py framework. I came across the framework last night and literally created and …">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="http://mherman.org/blog/2012/11/27/crash-course-in-web2py-part-1">
<link href="/favicon.png" rel="icon">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<link href="/atom.xml" rel="alternate" title="Michael Herman" type="application/atom+xml">
<script src="/javascripts/modernizr-2.0.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="/javascripts/libs/jquery.min.js"%3E%3C/script%3E'))</script>
<script src="/javascripts/octopress.js" type="text/javascript"></script>
<!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
<link href="//fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<link href="//fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">
<link href="//fonts.googleapis.com/css?family=Fjalla+One" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<!--- MathJax Configuration -->
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-37074204-1', 'auto');
ga('send', 'pageview');
</script>
</head>
<body class="collapse-sidebar sidebar-footer" >
<header role="banner"><hgroup>
<h1><a href="/">Michael Herman</a></h1>
<h2>Software Developer</h2>
</hgroup>
</header>
<nav role="navigation"><ul class="subscribe" data-subscription="rss">
<li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS" target="_blank"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="25" viewbox="0 0 100 100"><path class="social" d="M 13.310204,73.332654 C 5.967347,73.332654 0,79.322448 0,86.621428 c 0,7.338776 5.967347,13.262246 13.310204,13.262246 7.370408,0 13.328572,-5.92245 13.328572,-13.262246 0,-7.29898 -5.958164,-13.288774 -13.328572,-13.288774 z M 0.01530612,33.978572 V 53.143878 C 12.493878,53.143878 24.229592,58.02347 33.068368,66.865306 41.894898,75.685714 46.767346,87.47449 46.767346,100 h 19.25 C 66.017346,63.592858 36.4,33.979592 0.01530612,33.978572 l 0,0 z M 0.03877552,0 V 19.17449 C 44.54796,19.17551 80.77551,55.437756 80.77551,100 H 100 C 100,44.87653 55.15102,0 0.03877552,0 z"></path></svg></a></li>
</ul>
<form action="http://google.com/search" method="get">
<fieldset role="search">
<input type="hidden" name="sitesearch" value="mherman.org" />
<input class="search" type="text" name="q" results="0" placeholder="Search"/>
</fieldset>
</form>
<ul class="main-navigation">
<li><a href="/">Blog</a></li>
<li><a href="/about">About</a></li>
</ul>
</nav>
<div id="main">
<div id="content">
<div>
<article class="hentry" role="article">
<header>
<h1 class="entry-title">Crash Course in Web2py (Part 1)</h1>
<p class="meta">
<time class='entry-date' datetime='2012-11-27T19:53:00-07:00'><span class='date'><span class='date-month'>Nov</span> <span class='date-day'>27</span><span class='date-suffix'>th</span>, <span class='date-year'>2012</span></span> <span class='time'>7:53 pm</span></time>
</p>
</header>
<div class="entry-content"><p>This tutorial shows how to create a basic web app using the web2py framework. I came across the framework last night and literally created and deployed a web app in less than ten minutes.</p>
<p>Web2py is an open source web application framework that focuses on rapid development. By placing a strong emphasis on ease of use and productivity, it’s one of the easiest frameworks to learn and use. Despite its simplicity, though, web2py is jam packed with features and is quite powerful and flexible - much like the Python language itself.</p>
<blockquote><p>Be sure to check out the accompanying <a href="http://www.youtube.com/watch?v=BXzqmHx6edY">video</a>!</p></blockquote>
<h2>Download and Run</h2>
<p>Start by downloading the <a href="http://www.web2py.com/examples/default/download">latest</a> stable release.</p>
<p>Unpack the zip, run the web2py executable file, and choose an admin password.</p>
<p><img src="http://www.backwardsteps.com/uploads/2012-11-25_1642.png" alt="" /></p>
<h2>Create an App</h2>
<p>Click the Administrative Interface link on the right side of the page-</p>
<p><img src="http://www.backwardsteps.com/uploads/2012-11-25_1659.png" alt="" /></p>
<p>-and enter your password. The admin page shows your installed apps and provides an interface for creating and deploying new apps. On the right side of the page, under the <em>New simple application</em> header, type the name of a new app - in this example I used “helloWorld” - and then click Create.</p>
<p><img src="http://www.backwardsteps.com/uploads/2012-11-25_1704.png" alt="" /></p>
<p>You will then be redirected to the design interface page. You can also view the generic page for your app at this address - <a href="http://127.0.0.1:8000/helloWorld">http://127.0.0.1:8000/helloWorld</a>.</p>
<h2>Edit the App</h2>
<p>Back on the page, click the edit button next to “default.py” in the Controllers section.</p>
<p><img src="http://www.backwardsteps.com/uploads/2012-11-25_2035.png" alt="" /></p>
<p>Then change the default code for the index function to-</p>
<p><img src="http://www.backwardsteps.com/uploads/2012-11-25_2046.png" alt="" /></p>
<p>Hit CTRL-S on your keyboard to save the changes, then refresh <a href="http://127.0.0.1:8000/helloWorld/default/index">http://127.0.0.1:8000/helloWorld/default/index</a> to see the changes made.</p>
<h2>Deploy the App</h2>
<p>Go back to the admin page (<a href="http://127.0.0.1:8000/admin/default/site">http://127.0.0.1:8000/admin/default/site</a>) and click Pack All. Save the w2p-package to your computer.</p>
<p><img src="http://www.backwardsteps.com/uploads/2012-11-25_2317.png" alt="" /></p>
<p>Now you need to deploy the app to a cloud platform. The easiest one to use with web2py is <a href="https://www.pythonanywhere.com/">PythonAnywhere</a>. Go ahead and sign up. Once registered and logged in, click Web, Replace with a new web app, and then click the button for web2py.</p>
<p>Enter an admin password, and then click Next. Once the app is setup, go to the admin interface at <a href="https://your_user_name.pythonanywhere.com/admin">https://user_name.pythonanywhere.com/admin</a> (replace user_name with your user name) and enter your admin password to log-in. Now, to create your app, go to the <em>Upload and install packed application</em> section on the right side, give your app a name (helloWorld), and finally upload the w2p-file you saved to your computer earlier. Click install.</p>
<p><img src="http://www.backwardsteps.com/uploads/2012-11-26_00141.png" alt="" /></p>
<p>Finally, go to your homepage to view the app at <a href="https://your_user_name.pythonanywhere.com/admin">https://user_name.pythonanywhere.com</a> (replace user_name with your user name).</p>
<p>You just deployed your first app - congrats!</p>
<p><br></p>
<p><em>In the next <a href="http://mherman.org/blog/2012/12/01/crash-course-in-web2py-part-2-web-forms/">post</a>, I’ll show you how to create a much more advanced web app. Cheers!</em></p>
</div>
<footer>
<p class="meta">
<span class="byline author vcard">Authored by <span class="fn">
Michael Herman
</span></span>
<time class='entry-date' datetime='2012-11-27T19:53:00-07:00'><span class='date'><span class='date-month'>Nov</span> <span class='date-day'>27</span><span class='date-suffix'>th</span>, <span class='date-year'>2012</span></span> <span class='time'>7:53 pm</span></time>
<span class="categories">
<a class='category' href='/blog/categories/python/'>python</a>
</span>
</p>
<div class="sharing">
<!--
<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://mherman.org/blog/2012/11/27/crash-course-in-web2py-part-1/" data-via="" data-counturl="http://mherman.org/blog/2012/11/27/crash-course-in-web2py-part-1/" >Tweet</a>
<div class="fb-like" data-send="true" data-width="450" data-show-faces="false"></div>
-->
<br>
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
<a class="addthis_button_preferred_1"></a>
<a class="addthis_button_preferred_2"></a>
<a class="addthis_button_preferred_3"></a>
<a class="addthis_button_preferred_4"></a>
<a class="addthis_button_compact"></a>
<a class="addthis_counter addthis_bubble_style"></a>
</div>
<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-50e5f1cc35ad077d"></script>
<!-- AddThis Button END -->
<br>
</div>
<p class="meta">
<a class="basic-alignment left" href="/blog/2012/11/18/integration-of-content-creation-leads-google-towards-the-slippery-slope-of-monopolies/" title="Previous Post: Integration of Content Creation Leads Google Towards the Slippery Slope of Monopolies">« Integration of Content Creation Leads Google Towards the Slippery Slope of Monopolies</a>
<a class="basic-alignment right" href="/blog/2012/12/01/crash-course-in-web2py-part-2-web-forms/" title="Next Post: Crash Course in web2py (part 2 - web forms)">Crash Course in web2py (part 2 - web forms) »</a>
</p>
</footer>
</article>
<section>
<h1>Comments</h1>
<div id="disqus_thread" aria-live="polite"><noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
</section>
</div>
</div>
</div>
<footer role="contentinfo"><div>
<span>Copyright © 2017 - Michael Herman</span><br>
<a href="https://github.com/mjhea0"><i class="fa fa-github-square" style="font-size:2em" aria-hidden="true"></i></a>
<a href="https://twitter.com/mikeherman"><i class="fa fa-twitter-square" style="font-size:2em" aria-hidden="true"></i></a>
<a href="http://www.linkedin.com/pub/michael-herman/3b/a94/4"><i class="fa fa-linkedin-square" style="font-size:2em" aria-hidden="true"></i></a>
<a href="http://www.youtube.com/hermanmu"><i class="fa fa-youtube-square" style="font-size:2em" aria-hidden="true"></i></a>
</div>
</footer>
<script type="text/javascript">
var disqus_shortname = 'michaelherman';
// var disqus_developer = 1;
var disqus_identifier = 'http://mherman.org/blog/2012/11/27/crash-course-in-web2py-part-1/';
var disqus_url = 'http://mherman.org/blog/2012/11/27/crash-course-in-web2py-part-1/';
var disqus_script = 'embed.js';
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/' + disqus_script;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
}());
</script>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js#appId=212934732101925&xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<script type="text/javascript">
(function(){
var twitterWidgets = document.createElement('script');
twitterWidgets.type = 'text/javascript';
twitterWidgets.async = true;
twitterWidgets.src = '//platform.twitter.com/widgets.js';
document.getElementsByTagName('head')[0].appendChild(twitterWidgets);
})();
</script>
</body>
</html>