<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jayesh Kale</title>
    <description>The latest articles on DEV Community by Jayesh Kale (@jay_js).</description>
    <link>https://dev.to/jay_js</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F176662%2F67d648c8-0bd9-4fb9-ac63-e6e22edf979b.jpg</url>
      <title>DEV Community: Jayesh Kale</title>
      <link>https://dev.to/jay_js</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jay_js"/>
    <language>en</language>
    <item>
      <title>Basics of flask for creating RESTful web API's</title>
      <dc:creator>Jayesh Kale</dc:creator>
      <pubDate>Fri, 12 Jun 2020 05:38:48 +0000</pubDate>
      <link>https://dev.to/jay_js/basics-of-flask-for-creating-restful-web-api-s-2ff2</link>
      <guid>https://dev.to/jay_js/basics-of-flask-for-creating-restful-web-api-s-2ff2</guid>
      <description>&lt;p&gt;Did you know what flask is?, It's possible that you heard this word at least once if you have something to do with python. If you don't know then you're at right place. This will be three part series in 1st article we will discuss what flask is? and create hellow world app, &lt;br&gt;
in next article we will create sample app called photo bucket explaining creation of project step by step, whereas in futher post we will structure our project. Don't worry if you didn't know any of this term mentioned; i will explain them briefly where ever possible. so lets get started.&lt;/p&gt;
&lt;h2&gt;
  
  
  Flask
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;what is flask?&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Flask is a micro-web framework developed by &lt;a href="https://palletsprojects.com/"&gt;pallets projects&lt;/a&gt; for python to get started with creating api's quickly and easily.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;lets break down above to understand more efficiently:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;micro&lt;/strong&gt; meaning line of code for flask framework is less than what others offer. In practical flask doesn't enforce you too use only what flask provide or what should be directory structure. You can even make flask application in single python file or split it into multiple modules, however making application in single python file is not recommended as it will get utterly complex to manage as application grows. Main point to notice here is that flask doesn't come battery included so whats that actually mean? This means that like other framework it doesn't enforce you to only use framework specific ORM/ODM and drivers instead it lets you choose. Okay so lets you choose? suppose you want to include text-search support in your application for that you need search engine such as whoosh, elastic search other than that some databases also provide you with text search like mongodb now the question arises what will work with flask -&amp;gt; &lt;em&gt;all of them&lt;/em&gt;. and that's the beauty of this framework.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;framework&lt;/strong&gt; are the piece of code which consist regularly used functionality so you don't have to be code everything from scratch. for example, you use print() function in any language that print function is consist the logic detecting the string and variable as argument and then showing it on screen so you don't have to write everything and that will save your time and boost productivity. So framework are like predefined stuffs for you with some advanced features.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I think you have the idea now what flask is. so you can go to next topic. before that you will have to install flask do it with this command &lt;code&gt;pip install flask&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;note: flask work on extension to provide extra functionality there are plenty of extension on &lt;a href="https://pypi.org/"&gt;python package index&lt;/a&gt; you can search extension using flask-packagename. to learn more about extension hit &lt;a href="https://flask.palletsprojects.com/en/1.1.x/extensions/"&gt;this link.&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  Hello World
&lt;/h3&gt;

&lt;p&gt;app.py&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'/'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;hello_world&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Hello World!"&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;run&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;importing &lt;code&gt;Flask&lt;/code&gt; class from flask module.&lt;/li&gt;
&lt;li&gt;We are registering variable app as instance of flask&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;@app.route&lt;/code&gt; is decorator function used to provide path &lt;code&gt;'/'&lt;/code&gt; or you can write &lt;code&gt;'/helloworld'&lt;/code&gt; after the localhost address.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;return&lt;/code&gt; statement to output hello world! as string on browser.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;app.run()&lt;/code&gt; to run application&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;lets run it.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YTmWgo1d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/otgbirznp2vmw94722az.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YTmWgo1d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/otgbirznp2vmw94722az.png" alt="terminal"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JA9vbG7v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fzyvqhwjaxuj3wkwxsl3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JA9vbG7v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fzyvqhwjaxuj3wkwxsl3.png" alt="browser output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;whoillaa pat on your back you just created api in flask.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev-to-uploads.s3.amazonaws.com/i/sm4uy4lph311c2ndonbq.png"&gt;Download Flask cheatsheet here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>flask</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Setting up flutter without Android studio</title>
      <dc:creator>Jayesh Kale</dc:creator>
      <pubDate>Tue, 17 Sep 2019 21:05:28 +0000</pubDate>
      <link>https://dev.to/jay_js/setting-up-flutter-without-android-studio-olo</link>
      <guid>https://dev.to/jay_js/setting-up-flutter-without-android-studio-olo</guid>
      <description>&lt;p&gt;Sometimes due the hardware constraints or some other reasons developer will prefer light weight solution rather than Big Bulky Android Studio. So heres a good news for you in this article we will configure visual studio code to work with flutter without android studio. We are using ubuntu 19.04 as operating system but you can choose choice of your linux distros. So lets get started....&lt;/p&gt;

&lt;h1&gt;
  
  
  Packages we required
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip"&gt;Android command line tools&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.9.1+hotfix.2-stable.tar.xz"&gt;Flutter Binaries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://downloads.gradle-dn.com/distributions/gradle-5.6.2-bin.zip"&gt;Gradle build&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;OpenJDK 8 &lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Installing Packages
&lt;/h1&gt;

&lt;p&gt;We are installing it by following below steps respectively:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to folder where you downloaded your binaries.&lt;/li&gt;
&lt;li&gt;Extract it and move it to relevant location.&lt;/li&gt;
&lt;li&gt;Set up path and refresh .profile file to access utilities.&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Installing Packages
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;To set up path open profile type in terminal &lt;br&gt;
$ gedit ~/.profile &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Android tools
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ unzip sdk-tools-linux-4333796.zip
$ mkdir Android
$ mv tools/ Android/
$ sudo mv Android/ /usr/lib 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#android home&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANDROID_HOME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/lib/Android
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$ANDROID_HOME&lt;/span&gt;/tools:&lt;span class="nv"&gt;$PATH&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$ANDROID_HOME&lt;/span&gt;/tools/bin:&lt;span class="nv"&gt;$PATH&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$ANDROID_HOME&lt;/span&gt;/platform-tools:&lt;span class="nv"&gt;$PATH&lt;/span&gt;

&lt;span class="c"&gt;#android sdk root&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANDROID_SDK_ROOT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/lib/Android
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$ANDROID_SDK_ROOT&lt;/span&gt;:&lt;span class="nv"&gt;$PATH&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Flutter
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ tar xvf flutter_linux_v1.9.1+hotfix.2-stable.tar.xz
$ sudo mv flutter/ /usr/lib
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#flutter&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;FLUTTER_HOME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/lib/flutter
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$FLUTTER_HOME&lt;/span&gt;/bin:&lt;span class="nv"&gt;$PATH&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Gradle
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ unzip gradle-5.6.2-bin.zip
$ mkdir gradle
$ mv gradle-5.6.2/ gradle/
$ sudo mv gradle/ /opt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#gradle&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;GRADLE_HOME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/opt/gradle/gradle-5.6.2
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$GRADLE_HOME&lt;/span&gt;/bin:&lt;span class="nv"&gt;$PATH&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  OpenJDK 8
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Open synaptic package manager if you don't have it install via
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo apt install synaptic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Type in OpenJDK 8 to search bar.&lt;/li&gt;
&lt;li&gt;Select

&lt;ol&gt;
&lt;li&gt;openjdk-8-jdk&lt;/li&gt;
&lt;li&gt;openjdk-8-jdk-headless&lt;/li&gt;
&lt;li&gt;openjdk-8-jre&lt;/li&gt;
&lt;li&gt;openjdk-8-jre-headless&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;Apply and wait for install. Don't worry it will set up environment variable for you automatically.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Our installation of packages is done use subsequent command to refresh .profile&lt;br&gt;
$ . ~/.profile&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Setting up Android environment
&lt;/h1&gt;

&lt;p&gt;For setting Android environment you have to download following packages. I'm Downloading latest one as the date of publishing but you can download many system images to support wide array of devices using sdkmanager. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: If you're facing issue with sdkmanager as Warning: Could not create settings then open up terminal and type &lt;code&gt;$sdkmanager --sdk_root=${ANDROID_HOME} tools&lt;/code&gt; this will upgrade binaries to latest and everything will works as expected.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sdkmanager "system-images;android-29;google_apis;x86_64"
$ sdkmanager "platforms;android-29"
$ sdkmanager "platform-tools"
$ sdkmanager "patcher;v4"
$ sdkmanager "emulator"
$ sdkmanager "build-tools;29.0.2"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Accept all licenses using &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sdkmanager --licenses&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Setting up flutter config
&lt;/h1&gt;

&lt;p&gt;Update flutter config and set path to android sdk directory where it is installed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ flutter config --android-sdk /usr/lib/Android
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You have to install &lt;a href="https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter"&gt;flutter extension&lt;/a&gt; in visual studio code in order use flutter.&lt;/p&gt;

&lt;h1&gt;
  
  
  creating Emulator
&lt;/h1&gt;

&lt;p&gt;Create emulator with name pixel or choose the name you want&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ avdmanager -s create avd -n pixel -k "system-images;android-29;google_apis;x86_64"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create emulator using existing devices features&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ avdmanager -s create avd -n pixel -k "system-images;android-29;google_apis;x86_64" -d 19
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you can get list of exting devices using&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ avdmanager list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Moment of truth
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ flutter doctor -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;This command should give all green and ok except android studio path.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Run emulator
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ flutter emulator --launch pixel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's an image in action:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Yfg9vIg---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/nfjq2lqvu0kssevcqdg2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Yfg9vIg---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/nfjq2lqvu0kssevcqdg2.png" alt="Emulator"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>flutter</category>
      <category>vscode</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
