{"id":8735,"date":"2009-07-13T14:48:08","date_gmt":"2009-07-13T09:18:08","guid":{"rendered":"https:\/\/www.quickonlinetips.com\/archives\/?p=8735"},"modified":"2013-09-21T21:52:44","modified_gmt":"2013-09-21T16:22:44","slug":"web-application-development","status":"publish","type":"post","link":"https:\/\/www.quickonlinetips.com\/archives\/2009\/07\/web-application-development\/","title":{"rendered":"Getting Started with Web Application Development"},"content":{"rendered":"<p>In this tutorial, I&#8217;m going to show you how to <strong>build an impressive web application<\/strong>, including a <strong>sample<\/strong> to work with as we go along. I will be using <strong>Google App Engine<\/strong> and <strong>JQuery<\/strong>, which are by far the easiest and most effective tools to use at the moment.<\/p>\n<p>This means that your app will be hosted on Google&#8217;s servers for the best runtime for your users, and will use JQuery to include beautifully functional application-like features, with<strong> no knowledge of Javascript needed<\/strong>. This is a tutorial to harness the potential of new technologies in order to build your ideas, without the hassle of learning difficult programming languages, or splashing out on professional developers or hosting.<\/p>\n<h2>Google App Engine<\/h2>\n<p>First of all, you&#8217;re going to need a Google Account. I assume most people reading this have one already because of the fantastic services Google offer (GMail, etc.). If you have a Google Account, then go to <a href=\"http:\/\/appspot.com\" rel=\"nofollow noopener\">appspot.com<\/a>. If you don&#8217;t, you can sign up for one there &#8211; the benefits of a Google Account are enormous. Once you are at appspot.com, sign in with your account username and password. Click &#8220;<strong>Create an Application<\/strong>&#8220;.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-8753\" title=\"apps home\" src=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/appspothome.gif\" alt=\"apps home\" width=\"400\" height=\"236\" border=\"1\" \/><\/p>\n<p>Choose an <strong>Application Identifier<\/strong>, for your app, but remember that it doesn&#8217;t have to end up being the name of your app by any means. For instance, for my first app I used my name, and the service I ended up making doesn&#8217;t even belong to me any more and is being served on another domain. The <strong>Application Title<\/strong> is more important, so think about what your app is going to be about. Again, it isn&#8217;t critical for this name to be final. When you&#8217;re done with this, click &#8220;save&#8221;.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-8754\" title=\"creating app\" src=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/creatingapp.gif\" alt=\"creating app\" width=\"500\" height=\"293\" border=\"1\" srcset=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/creatingapp.gif 500w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/creatingapp-300x175.gif 300w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/p>\n<p>For this <strong>demonstration<\/strong>, I&#8217;m actually going to be creating a new application myself. I&#8217;ve called it &#8220;Get Your Kicks on Route 66&#8221;, and the Identifier I&#8217;ve used is &#8220;stringsthattie.appspot.com&#8221;. See, the identifiers that I&#8217;ve used are quite trivial! This is because I know I can always move my application to another domain. Click &#8220;save&#8221; to proceed. Well done! You&#8217;ve just <strong>registered an application<\/strong> with Google Apps. Now let&#8217;s take this a step further.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-8759\" title=\"register success\" src=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/registersuccess.gif\" alt=\"register success\" width=\"500\" height=\"173\" border=\"1\" srcset=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/registersuccess.gif 500w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/registersuccess-300x103.gif 300w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/p>\n<p>Now you should download the <strong>Google App Engine toolkit <\/strong>(it&#8217;s called an SDK &#8211; standard development kit), as well as Python. Now, don&#8217;t worry &#8211; it may sound intimidating, but I&#8217;m going to guide you very smoothly through this, don&#8217;t worry about a thing. You can first <a href=\"http:\/\/code.google.com\/appengine\/downloads.html\" rel=\"nofollow noopener\">download Google App Engine SDK<\/a>. Choose one of the three options, as described in the image below. Make sure you remember where you install the SDK, and do so in an accessible place.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-8755\" title=\"engine sdk\" src=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/enginesdk.gif\" alt=\"engine sdk\" width=\"500\" height=\"233\" border=\"1\" srcset=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/enginesdk.gif 500w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/enginesdk-300x139.gif 300w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/p>\n<h2>Get Python<\/h2>\n<p>Now, <strong>download Python<\/strong>, from <a href=\"http:\/\/www.python.org\/download\/\" rel=\"nofollow noopener\">www.python.org\/download<\/a><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-8758\" title=\"python download\" src=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/pythondown.gif\" alt=\"python download\" width=\"400\" height=\"199\" border=\"1\" srcset=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/pythondown.gif 400w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/pythondown-300x149.gif 300w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/p>\n<p><strong>Install Python<\/strong> (very self-explanatory). Now, open the folder where you&#8217;ve saved the Google App Engine SDK. Make a new folder there, and name it something short that describes your application (it can be anything, mine is &#8220;string&#8221;). Once you&#8217;ve done that, make three new notes in a simple application like notepad (I&#8217;m going to be using Windows Notepad, but I would also suggest that you download <a href=\"http:\/\/notepad-plus.sourceforge.net\/\" rel=\"nofollow noopener\">Notepad++<\/a> for future developments). Save the first one as &#8220;<strong>app.yaml<\/strong>&#8220;, the second as &#8220;<strong>main.py<\/strong>&#8220;, and the third as &#8220;<strong>index.html<\/strong>&#8220;. Make sure they don&#8217;t have &#8220;.txt&#8221; at the end of the file name &#8211; to avoid this, when saving set &#8216;<em>Save As Type&#8217; to &#8216;All Files<\/em>&#8216;.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-8756\" title=\"files done\" src=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/filesdone.gif\" alt=\"files done\" width=\"423\" height=\"246\" border=\"1\" srcset=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/filesdone.gif 423w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/filesdone-300x174.gif 300w\" sizes=\"(max-width: 423px) 100vw, 423px\" \/><\/p>\n<p>Now, put the following code into the <strong>main.py<\/strong> file:<\/p>\n<pre><code>from google.appengine.ext import webapp\r\nfrom google.appengine.ext.webapp.util import run_wsgi_app\r\nfrom google.appengine.ext.webapp import template\r\nfrom google.appengine.ext import db\r\nimport cgi\r\nimport os\r\nclass Table (db.Model):\r\n    element = db.StringProperty()\r\nclass Index(webapp.RequestHandler):\r\n    def get(self):\r\n\ttemplate_values = {}\r\n        path = os.path.join(os.path.dirname(__file__), 'index.html')\r\n        self.response.out.write(template.render(path, template_values))\r\napplication = webapp.WSGIApplication([('\/', Index)],\r\n                                     debug=True)\r\ndef main():\r\n  run_wsgi_app(application)\r\nif __name__ == \"__main__\":\r\n  main()<\/code><\/pre>\n<p>If you don&#8217;t understand any of that, DON&#8217;T WORRY, it&#8217;s perfectly normal ;) I&#8217;m writing this for you. For those of you who do understand bits of it, or even all of it, you will be able to leverage more of Google App Engine&#8217;s features later on.<\/p>\n<p>In the<strong> app.yaml<\/strong> file, put this next piece of coding, but replace [your app] with your app name:<\/p>\n<pre><code>application: [your app]\r\nversion: 1\r\nruntime: python\r\napi_version: 1\r\nhandlers:\r\n- url: \/.*\r\n  script: main.py<\/code><\/pre>\n<p>In the<strong> index.html<\/strong> file, put this:<\/p>\n<pre><code>&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\nh1, h2, h3 {\r\n  font-family: Georgia, \"Times New Roman\", Times, serif;\r\n  font-weight: normal;\r\n  color: #006EA6;\r\n  }\r\nh1 {\r\n  letter-spacing: -1px;\r\n  font-size: 35px;\r\n  }\r\nh2 {\r\n  font-size: 20px;\r\n  }\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;h1&gt;My Website&lt;\/h1&gt;\r\n&lt;h2 id=\"info\"&gt;Hi, this is my new website! It is hosted on Google App Engine servers, and makes use of complex AJAX APIs!&lt;\/h2&gt;\r\n&lt;button id=\"change\"&gt;More Information&lt;\/button&gt;\r\n&lt;script type=\"text\/javascript\" src=\"http:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.3.2\/jquery.js\" \/&gt;\r\n&lt;script type=\"text\/javascript\"&gt;\r\n $(document).ready(function(){\r\n  $(\"#change\").toggle(\r\n   function () {\r\n    $(\"#info\").css({\"color\":\"#8BCB2F\"});\r\n    $(\"#info\").text(\"This is so exciting!\");\r\n   },\r\n   function () {\r\n    $(\"#info\").css({\"color\":\"#006EA6\"});\r\n    $(\"#info\").text(\"Can't wait to do more!\");\r\n   }\r\n  );\r\n});\r\n&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<h2>Upload to Google Servers<\/h2>\n<p>Now, if you open that index.html file in your browser, you should see an interesting little program working! Great. Now that you&#8217;ve saved all of these files, we can<strong> upload them onto Google&#8217;s servers<\/strong>, and test them out for real! For this, you need to open up<strong> command prompt<\/strong>, or Terminal if you&#8217;re using a Mac. Do you know where you&#8217;ve stored all your files for your website? For me, it&#8217;s at, &#8220;<em>D:GraemeWork &#8211; FunPythonGoogle Appstring<\/em>&#8220;. So the first thing I&#8217;m going to type into my command prompt is &#8220;d:&#8221;, and then hit enter.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-8757\" title=\"prompt\" src=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/promtd.gif\" alt=\"prompt\" width=\"500\" height=\"106\" border=\"1\" srcset=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/promtd.gif 500w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/promtd-300x63.gif 300w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/p>\n<p>Now I&#8217;m on the D-drive, so I&#8217;ll type in cd &#8220;D:GraemeWork &#8211; FunPythonGoogle App&#8221; and press enter. This is one folder short of where my files are saved, and should be where the Google App Engine SDK is (if you listened to me earlier). Right, so all we have to do now is type in &#8220;<strong>appcfg.py update<\/strong> [your app&#8217;s folder]&#8221; &#8211; replace [your app&#8217;s folder] with the name of the folder that contains your website&#8217;s files. For me, I will type &#8220;appcfg.py update string&#8221;. Press enter. The prompt will ask you for your Google Account email address and password (for me that&#8217;s ,,, no not so fast!<\/p>\n<p>If you&#8217;ve done everything correctly, a few lines will come up explaining that your application is uploading itself. Nice and easy! Mine has just finished loading, so I&#8217;m going to check it out at &#8220;http:\/\/stringsthattie.appspot.com&#8221;.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-8760\" title=\"stringsthattie\" src=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/stringsthattie.gif\" alt=\"stringsthattie\" width=\"365\" height=\"195\" border=\"1\" srcset=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/stringsthattie.gif 365w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/stringsthattie-300x160.gif 300w\" sizes=\"(max-width: 365px) 100vw, 365px\" \/><\/p>\n<p>Okay, that concludes our introductory lesson on<strong> writing web applications<\/strong>! I would suggest that you work on your index.html file, and play around with the JQuery I have done for you there. There are many<strong> JQuery tutorials<\/strong> on the internet. Learning enough Python to continue making your application better is very easy, and there are many tutorials, some of which are on my blog. Purchasing your own domain will mean that you can run your web application from the web address that you want. Google will still run your app from their servers, so this is very convenient.<\/p>\n<p><em>This post was written by Graeme Alan, a programmer with expertise in Python and Java, as well as many common web languages. While learning the Google App Engine platform, he created his own blogging system, which he frequently updates at PyThoughts.com. You can also share your tips and <a href=\"https:\/\/www.quickonlinetips.com\/archives\/guest-blogging\/\">write a guest article<\/a> on QOT.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, I&#8217;m going to show you how to build an impressive web application, including a sample to work&#8230;<\/p>\n","protected":false},"author":4,"featured_media":8760,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[3],"tags":[44,49],"class_list":["post-8735","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-google","tag-guest-posts","tag-tutorials"],"_links":{"self":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/8735","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/comments?post=8735"}],"version-history":[{"count":0,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/8735\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/media\/8760"}],"wp:attachment":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/media?parent=8735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/categories?post=8735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/tags?post=8735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}